PageSourceSearch

https://amcham.co.za/modules/contrib/copyprevention/js/copyprevention.js?tkgx89

js amcham.co.za collected 2026-09-28 10:07:22 UTC 2,171 bytes, 58 lines download raw bytes

1(function ($, Drupal, window, document, undefined) {
2  Drupal.behaviors.copyprevention = {
3    attach: function (context, settings) {
4      $.each(settings.copyprevention.body, function (index, value) {
5        $('body').bind(value, function (event) {
6          return false;
7        });
8      });
9      var $images = $('img', context);
10      $.each(settings.copyprevention.images, function (index, value) {
11        if (value == 'contextmenu') {
12          $images.bind('contextmenu', function (event) {
13            return false;
14          });
15        }
16        if (value == 'transparentgif') {
17          Drupal.copyprevention.initialize($images, settings);
18        }
19      });
20    }
21  };
22
23  Drupal.copyprevention = {
24    initialize: function ($images, settings) {
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, settings);
35          });
36        }
37        else {
38          self.process.call(this, settings);
39        }
40      });
41    },
42    process: function (settings) {
43      if (this.naturalWidth > settings.copyprevention.images_min_dimension || this.naturalHeight > settings.copyprevention.images_min_dimension) {
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="' + 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, Drupal, window, this.document);

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.