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 column = $(".js-open-modal").data("column"); 65 var style = $(".js-open-modal").data("style"); 66 var search = $(".js-open-modal").data("search"); 67 var category = $(".js-open-modal").data("category"); 68 var upvote = $(".js-open-modal").data("upvote"); 69 var list_id = $(".js-open-modal").data("listid"); 70 var ctitle = $(".js-open-modal").data("ctitle"); 71 var clink = $(".js-open-modal").data("clink"); 72 73 74 $('a[data-modal-id]').click(function (e) { 75 76 e.preventDefault(); 77 $("body").append(appendthis); 78 $(".modal-overlay").fadeTo(500, 0.7); 79 //$(".js-modalbox").fadeIn(500); 80 var modalBox = $(this).attr('data-modal-id'); 81 $('#' + modalBox).fadeIn($(this).data()); 82 83 $('body').addClass('modalOn'); 84 85 }); 86 87 88jQuery(document).on('click', ".js-modal-close, .modal-overlay", function(event){ 89 90 91 // $(".js-modal-close, .modal-overlay").click(function () { 92 $(".modal-box, .modal-overlay").fadeOut(500, function () { 93 $(".modal-overlay").remove(); 94 }); 95 $('body').removeClass('modalOn'); 96 }); 97 98 $(window).resize(function () { 99 $(".modal-box").css({ 100 //top: ($(window).height() - $(".modal-box").outerHeight()) / 2, 101 //left: ($(window).width() - $(".modal-box").outerWidth()) / 2 102 }); 103 }); 104 105 $(window).resize(); 106 107 108 $("#generate-igcode_ilist").on("click", function () { 109 110 var i_height = $("#igheight").val(); 111 var i_width = $("#igwidth").val(); 112 var selected_value = $(".iframe-main-select option:selected").text(); 113 var extn = ''; 114 115 var ctitle = $(".js-open-modal").data("ctitle"); 116 var clink = $(".js-open-modal").data("clink"); 117 118 if(selected_value.match(/px/g)){ 119 extn='px'; 120 } 121 if(selected_value.match(/%/g)){ 122 extn='%'; 123 } 124 125 var iframe_template = '<iframe src="' + url + '/?order=' + ordering + '&mode=' + mode + '&column=' + column + '&style=' + style + '&search=' + search + '&category=' + category + '&list_id='+ list_id +'&upvote=' + upvote + '" ' 126 + ' scrolling="auto" ' + 'height="' + i_height + 'px' + '" width="' + i_width + extn + '" frameborder="0"></iframe>'; 127 var ext = ''; 128 if(ctitle.length>0 || clink.length>0){ 129 if(ctitle.length>0 && clink.length>0){
130 ext +='<span style="float:right; margin:10px;">List Created by <a href="'+clink+'" target="_blank">'+ctitle+'</a></span>'; 131 }else{ 132 ext +='<span style="float:right; margin:10px;">List Created by <a href="'+clink+'" target="_blank">'+ctitle+'</a></span>'; 133 } 134 135 } 136 iframe_template +=ext; 137 $(".ilist_igcode_textarea").html(iframe_template); 138 copyToClipboard(document.getElementById("ilist_igcode_textarea")); 139 $("#ilist_igcode_textarea").select(); 140 141 }); 142 143 144});
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.