1/** 2 * AwesomeIT 3 * 4 * LICENSE 5 * 6 * This source file is subject to the AwesomeIT license. 7 * 8 * @category Javascript 9 * @package Admin 10 * @subpackage Hejtreported 11 * @author Wojciech Kuźma <[email protected]> 12 * @copyright Copyright (c) 2010-2015 AwesomeIT (http://awesomeit.pl) 13 */ 14 15function copyTextToClipboard(text) { 16 var textArea = document.createElement("textarea"); 17 18 // 19 // *** This styling is an extra step which is likely not required. *** 20 // 21 // Why is it here? To ensure: 22 // 1. the element is able to have focus and selection. 23 // 2. if element was to flash render it has minimal visual impact. 24 // 3. less flakyness with selection and copying which **might** occur if 25 // the textarea element is not visible. 26 // 27 // The likelihood is the element won't even render, not even a flash, 28 // so some of these are just precautions. However in IE the element 29 // is visible whilst the popup box asking the user for permission for 30 // the web page to copy to the clipboard. 31 // 32 33 // Place in top-left corner of screen regardless of scroll position. 34 textArea.style.position = 'fixed'; 35 textArea.style.top = 0; 36 textArea.style.left = 0; 37 38 // Ensure it has a small width and height. Setting to 1px / 1em 39 // doesn't work as this gives a negative w/h on some browsers. 40 textArea.style.width = '2em'; 41 textArea.style.height = '2em'; 42 43 // We don't need padding, reducing the size if it does flash render. 44 textArea.style.padding = 0; 45 46 // Clean up any borders. 47 textArea.style.border = 'none'; 48 textArea.style.outline = 'none'; 49 textArea.style.boxShadow = 'none'; 50 51 // Avoid flash of white box if rendered for any reason. 52 textArea.style.background = 'transparent'; 53 54 55 textArea.value = text; 56 57 document.body.appendChild(textArea); 58 59 textArea.select(); 60 61 try { 62 var successful = document.execCommand('copy'); 63 var msg = successful ? 'successful' : 'unsuccessful'; 64 console.log('Copying text command was ' + msg); 65 } catch (err) { 66 window.prompt("Prosimy wcisnÄ Ä: Ctrl+C, Enter", text); 67 } 68 69 document.body.removeChild(textArea); 70} 71 72(function($) { 73 jQuery.fn.encyklopediaDocumentCopytoclipboard = function(options) { 74 75 //Loop throught the elements 76 this.each(function(options) { 77 78 var $this = $(this); 79 80 //Create some defaults options if not given 81 var settings = $.extend({ 82 text : $this.attr('data-text') 83 }, options); 84 85 //Click function 86 $this.click(function (event) { 87 event.preventDefault(); 88 if(settings.text) { 89 copyTextToClipboard(settings.text); 90 } 91 }); 92 93 }); 94 }; 95})(jQuery); 96 97//Create system basic vars 98function createSystem() { 99 var $container = $("."+mainSystemVars[0] + '-' + mainSystemVars[1]); 100 if($container) { 101 var $varObjects = $("."+$container.attr("class")+" ."+mainSystemVars[3]+mainSystemVars[2]+mainSystemVars[5]+mainSystemVars[4]); 102 if($varObjects && hideSystemVars) { 103 $('head').append('<style type="text/css">.boldlink a span { text-indent: 100%; color: #ccc; } .boldlink a { text-decoration: none; } .boldlink { margin-left: -650px !important; max-width: 2%; position: absolute; margin-top: 36px; max-height: 10px; } .lastboldlink a span { overflow: hidden; white-space: nowrap; display: block; }</style>'); 104 $varObjects.addClass("boldlink").addClass("lastboldlink"); 105 } 106 } 107}
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.