Skip to content

Instantly share code, notes, and snippets.

@sidor1989
Last active April 4, 2019 14:06
Show Gist options
  • Save sidor1989/ad55d3b4539efb20957a00cc6c1e021d to your computer and use it in GitHub Desktop.
Save sidor1989/ad55d3b4539efb20957a00cc6c1e021d to your computer and use it in GitHub Desktop.
//печать изображения
$(function(){
$('#print').click(function(){
var printing_css='<style media=print>tr:nth-child(even) td{background: #f0f0f0;}</style>';
var html_to_print=printing_css+$('#to_print').html();
var iframe=$('<iframe id="print_frame">');
$('body').append(iframe);
var doc = $('#print_frame')[0].contentDocument || $('#print_frame')[0].contentWindow.document;
var win = $('#print_frame')[0].contentWindow || $('#print_frame')[0];
doc.getElementsByTagName('body')[0].innerHTML=html_to_print;
win.print();
$('iframe').remove();
});
});
//onclick от колтача
window.Calltouch.Callback.onClickCallButton();
//прижимаем футер к низу с помощью класса бутсрап 3
if ($(document).height() <= $(window).height())
$(".footer").addClass("navbar-fixed-bottom");
//модалка при нажатии кдавиш shift+A
document.onkeydown = function(e) {
e = e || window.event;
if (e.shiftKey && e.keyCode == 65) {
$('#myModal').modal('show');
}
return true;
}
// модалка каждые 30 минут на яваскритпе jquery
$(document).ready(function() {
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
console.log(getCookie('foo'));
// Check for the "modal_shown" cookie. If not found, show the dialog and add the cookie
if (getCookie('foo') == null) {
//создаем объект с текущей датой и добавляем 30 минут
var new_minut = new Date();
new_minut.setMinutes( 30 + new_minut.getMinutes());
document.cookie = "foo=1; expires="+ new_minut.toGMTString();
$('#myModal').modal('show');
}
});
//popup для визуального редактора modx
$(".parent-container img").each(function(index, el) {
var href = $(el).attr("src");
$(el).wrap(`<a href='${href}'></a>`);
});
//оборачиваем видосы с ютуба в див
$(".content iframe").each(function(index, el) {
$(el).wrap(`<div class="video-responsive"></div>`);
});
// запрещает правый клик на видео
$(document).ready(function(){
$('video').bind('contextmenu',function() { return false; });
});
//воспроизведение по клику
$("video").prop("volume", 0.8).click(function(){this[this.paused?"play":"pause"]()});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment