PageSourceSearch

https://www.perfettivanmelle.com/assets/script/lib/jquery.brands.js

js perfettivanmelle.com collected 2026-10-02 07:55:09 UTC 3,772 bytes, 123 lines download raw bytes

1jQuery.fn.extend({ 
2	brands: function() {
3		
4		return this.each(function() {
5
6		// SETUP
7		$(".brandcontentwrapper").remove();
8		
9		// VARIABLES
10			var element = $(this),
11				brandItems = element.find("#branditems"),
12				totalBrands = brandItems.find(".branditem").length
13
14		// FUNCTIONS
15			var createLoadBox = function(itemId, itemRowId, itemHash, itemRow, tipPos) {
16				element.attr("data-row", itemRow)
17				var openPoint = (itemRow*5)-1
18				if(openPoint>totalBrands) {
19					openPoint = (totalBrands-1)
20				}
21				brandItems.find(".branditem").eq(openPoint)
22					.after('<div id="brandload" style="display:none"><div class="brandcontent"><img src="/assets/images/site_objects/indicator.gif" alt="Loading" /></div></div>')
23				$("#brandload").load("/our-brands/overview/ "+itemHash, function() {
24					$(".brandtip").css("left", tipPos+80).show();
25					$("#brandload").slideDown();
26					$(".close").show();
27					$('html, body').animate({
28				        scrollTop: $("#"+itemId).offset().top
29					}, 300);
30					google_analytics("Regional Brands","BrandId="+itemHash.replace('#','')+" : Open")
31				})		
32			}
33
34			var slideTip = function(itemId, itemRowId, itemHash, itemRow, tipPos) {
35				element.attr("data-row", itemRow)
36				$(".brandtip").show().animate({
37					"left": tipPos+80
38				},100);
39				$("#brandload").load("/our-brands/overview/ "+itemHash, function() {
40				    $(".brandtip").css("left", tipPos + 80).show();
41				    $(".close").show();
42					$('html, body').animate({
43				        scrollTop: $("#"+itemId).offset().top
44				    }, 300);
45				    google_analytics("Regional Brands","BrandId="+itemHash.replace('#','')+" : Open")
46				});	
47			}
48
49
50		// USER ACTIONS
51
52			// Click on a brand...
53			brandItems.on('click', '.branditem a', function(e) {
54				var brand = $(this),
55					itemId = brand.attr("id"),
56					currentRow = element.attr("data-row"),
57					itemRowId = brand.attr("data-id"),
58					itemHash = brand.attr("href"),
59					itemRow = Math.ceil(itemRowId/5),
60					tipPos = brand.parent().position().left;
61				
62				if(!$(this).hasClass("lit")) {
63					brandItems.find(".lit").removeClass("lit")
64					$(this).addClass("lit");
65
66					if($("#brandload").get(0)){
67						if(currentRow == itemRow) {
68						    slideTip(itemId, itemRowId, itemHash, itemRow, tipPos)
69						} else {
70							element.find("#brandload").slideUp(400, function() {
71								element.find("#brandload").remove();
72								createLoadBox(itemId, itemRowId, itemHash, itemRow, tipPos)
73							});
74						}
75					} else {
76						createLoadBox(itemId, itemRowId, itemHash, itemRow, tipPos)
77					}
78				} else {
79					$(this).removeClass("lit")
80					element.find("#brandload").slideUp(200, function() {
81						element.find("#brandload").remove();
82						element.removeAttr("data-row")
83					});
84					google_analytics("Regional Brands","BrandId="+itemHash.replace('#','')+" : Close")
85				}
86				e.preventDefault();
87			});
88
89
90			element.on('click', '.close', function(e) {
91				var itemHash = $(this).parent().attr("id");
92				brandItems.find(".lit").removeClass("lit")
93				element.find("#brandload").slideUp(200, function() {
94					element.find("#brandload").remove();
95				});
96				google_analytics("Regional Brands","BrandId="+itemHash+" : Close")
97				e.preventDefault();
98			});
99			
100
101
102		// REFERENCE FROM ELSEWHERE
103
104			if(window.location.hash) {
105				var hash = window.location.hash.substring(7),
106					itemId = hash,
107					itemElement = element.find("#"+itemId),
108					itemRowId = itemElement.attr("data-id"),
109					itemHash = itemElement.attr("href"),
110					itemRow = Math.ceil(itemRowId/5),
111					tipPos = itemElement.parent().position().left;
112				if(itemRowId!="") {
113					$("#"+itemId).addClass("lit");
114					createLoadBox(itemId, itemRowId, itemHash, itemRow, tipPos)
115				}
116			}
117
118
119		});
120	}
121});
122
123jQuery("#brandcontent").brands();

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.