1(function ($) { 2 3 Drupal.behaviors.copyprevention = {}; 4 Drupal.behaviors.copyprevention.attach = function(context, settings) { 5 $.each(Drupal.settings.copyprevention.body, function(index, value) { 6 $('body').bind(value, function(event) { 7 return false; 8 }); 9 }); 10 var $images = $('img', context); 11 $.each(Drupal.settings.copyprevention.images, function(index, value) { 12 if (value == 'contextmenu') { 13 $images.bind('contextmenu', function(event) { 14 return false; 15 }); 16 } 17 if (value == 'transparentgif') { 18 Drupal.copyprevention.initialize($images); 19 } 20 }); 21 }; 22 23 Drupal.copyprevention = { 24 initialize: function($images) { 25 var self = this; 26 $images.each(function(index, Element) { 27 if ($(this).hasClass('copyprevention-processed')) { 28 return; 29 } 30 $(this).addClass('copyprevention-processed'); 31 32 if (this.naturalWidth == 0 || this.naturalHeight == 0) { 33 $(this).bind('load', function() { 34 self.process.call(this); 35 }); 36 } 37 else { 38 self.process.call(this); 39 } 40 }); 41 }, 42 process: function() { 43 if (this.naturalWidth > Drupal.settings.copyprevention.images_min_dimention || this.naturalHeight > Drupal.settings.copyprevention.images_min_dimention) { 44 $(this).bind('mouseover touchstart', function(event) { 45 //var pos = $(this).offset(); 46 var pos = $(this).position(); 47 var html = '<div class="copyprevention-transparent-gif" style="position: absolute; left: ' + pos.left + 'px; top: ' + pos.top + 'px">' + 48 '<img src="' + Drupal.settings.copyprevention.transparentgif + '" style="width: ' + this.clientWidth + 'px !important; height: ' + this.clientHeight + 'px !important;"></div>';
49 //var $overlay = $(html).appendTo('body') 50 var $overlay = $(html).insertAfter(this) 51 .bind('mouseout', function(e) { 52 $overlay.remove(); 53 }); 54 }); 55 } 56 } 57 }; 58})(jQuery);
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.