1function copyToClipboard(elem) { 2 // create hidden text element, if it doesn't already exist 3 var targetId = "_hiddenCopyText_"; 4 var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA"; 5 var origSelectionStart, origSelectionEnd; 6 if (isInput) { 7 // can just use the original source element for the selection and copy 8 target = elem; 9 origSelectionStart = elem.selectionStart; 10 origSelectionEnd = elem.selectionEnd; 11 } else { 12 // must use a temporary form element for the selection and copy 13 target = document.getElementById(targetId); 14 if (!target) { 15 var target = document.createElement("textarea"); 16 target.style.position = "absolute"; 17 target.style.left = "-9999px"; 18 target.style.top = "0"; 19 target.id = targetId; 20 document.body.appendChild(target); 21 } 22 target.textContent = elem.textContent; 23 } 24 // select the content 25 var currentFocus = document.activeElement; 26 target.focus(); 27 target.setSelectionRange(0, target.value.length); 28 29 // copy the selection 30 var succeed; 31 try { 32 succeed = document.execCommand("copy"); 33 } catch (e) { 34 succeed = false; 35 } 36 // restore original focus 37 if (currentFocus && typeof currentFocus.focus === "function") { 38 currentFocus.focus(); 39 } 40 41 if (isInput) { 42 // restore prior selection 43 elem.setSelectionRange(origSelectionStart, origSelectionEnd); 44 } else { 45 // clear temporary content 46 target.textContent = ""; 47 } 48 return succeed; 49} 50 51 52jQuery(document).ready(function ($) { 53 var appendthis = ("<div class='modal-overlay js-modal-close'></div>"); 54 55 56 /** 57 * 58 * @type {jQuery} 59 * Get shortcode data from custom attribute 60 */ 61 var ordering = $(".js-open-modal").data("order"); 62 var url = $(".js-open-modal").data("url"); 63 var mode = $(".js-open-modal").data("mode"); 64 var list_id = $(".js-open-modal").data("list-id"); 65 var column = $(".js-open-modal").data("column"); 66 var style = $(".js-open-modal").data("style"); 67 var search = $(".js-open-modal").data("search"); 68 var category = $(".js-open-modal").data("category"); 69 var upvote = $(".js-open-modal").data("upvote"); 70 71 72 $('a[data-modal-id]').click(function (e) { 73 74 e.preventDefault(); 75 76 $("body").append(appendthis); 77 $(".modal-overlay").fadeTo(500, 0.7); 78 //$(".js-modalbox").fadeIn(500); 79 var modalBox = $(this).attr('data-modal-id'); 80 $('#' + modalBox).fadeIn($(this).data()); 81 82 $('body').addClass('modalOn'); 83 84 }); 85 86 87jQuery(document).on('click', ".js-modal-close, .modal-overlay", function(event){ 88 89 90 // $(".js-modal-close, .modal-overlay").click(function () { 91 $(".modal-box, .modal-overlay").fadeOut(500, function () { 92 $(".modal-overlay").remove(); 93 }); 94 $('body').removeClass('modalOn'); 95 }); 96 97 $(window).resize(function () { 98 $(".modal-box").css({ 99 //top: ($(window).height() - $(".modal-box").outerHeight()) / 2, 100 //left: ($(window).width() - $(".modal-box").outerWidth()) / 2 101 }); 102 }); 103 104 $(window).resize(); 105 106 107 $("#generate-igcode").on("click", function () { 108 109 var list_id_ext = "&list_id="; 110 111 if( list_id != "" || list_id != null ){ 112 list_id_ext = '&list_id=' + list_id; 113 } 114 115 var i_height = $("#igheight").val(); 116 var i_width = $("#igwidth").val(); 117 var selected_value = $(".iframe-main-select option:selected").text(); 118 var iframe_template = '<iframe src="' + url + '/?order=' + ordering + '&mode=' + mode + list_id_ext + '&column=' + column + '&style=' + style + '&search=' + search + '&category=' + category + '&upvote=' + upvote + '" ' 119 + ' scrolling="yes" ' + 'height="' + i_height + 'px' + '" width="' + i_width + selected_value + '" frameborder="0"></iframe>'; 120 121 $(".igcode_textarea").html(iframe_template); 122 copyToClipboard(document.getElementById("igcode_textarea")); 123 $("#igcode_textarea").select(); 124 125 });
126 127 128});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.