1/** 2 * Polaris 3 */ 4 5var Design = { 6 bindKeys : function() { 7 Cargo.Core.KeyboardShortcut.Add("Left", 37, function() { 8 Action.Project.Prev(); 9 return false; 10 }); 11 12 Cargo.Core.KeyboardShortcut.Add("Right", 39, function() { 13 Action.Project.Next(); 14 return false; 15 }); 16 }, 17 18 hoverProject: function() { 19 // Thumbnail hover 20 $(".thumbnails") 21 .on("mouseenter", ".project_thumb", function(e) { 22 $(".project_link[data-id='" + $(this).attr("data-id") +"'] a").addClass("hover"); 23 }) 24 .on("mouseleave", ".project_thumb", function(e) { 25 $(".project_link[data-id='" + $(this).attr("data-id") +"'] a").removeClass("hover"); 26 }); 27 28 // Navigation 29 $(".navigation") 30 .on("mouseenter", ".project_link a", function(e) { 31 $(".project_thumb[data-id='" + $(this).closest('.project_link').attr("data-id") +"']").addClass("hover"); 32 }) 33 .on("mouseleave", ".project_link a", function(e) { 34 $(".project_thumb[data-id='" + $(this).closest('.project_link').attr("data-id") +"']").removeClass("hover"); 35 }); 36 }, 37 38 checkNavigationHeight: function() { 39 40 41 var navigation = $(".navigation"); 42 43 if(navigation.length === 0){ 44 return; 45 } 46 47 var pad_top = (navigation.css('padding-top')) ? Math.floor(navigation.css('padding-top').replace("px","")) : 0, 48 margin_top = (navigation.css('margin-top')) ? Math.floor(navigation.css('margin-top').replace("px","")) : 0, 49 top_height = navigation.position().top + pad_top + margin_top; 50 51 if (navigation.length > 0) { 52 if (navigation.height() + top_height > $(window).height()) { 53 if (!navigation.hasClass("scroll")) { 54 navigation.add(".site_header").removeClass("fixed").addClass("scroll"); 55 } 56 } else { 57 if (!navigation.hasClass("fixed")) { 58 navigation.add(".site_header").removeClass("scroll").addClass("fixed"); 59 } 60 } 61 } 62 }, 63 64 checkSetVisibility: function() { 65 // Find the active set based on the project ID 66 var parentSet = $("[data-setid='" + Cargo.Model.Project.GetSetId() + "']"), 67 otherSets = $("[data-setid]").not(parentSet); 68 69 // If the set exists, set active/inactive 70 if (parentSet.length > 0) { 71 otherSets.removeClass("active").addClass("inactive"); 72 parentSet.removeClass("inactive").addClass("active"); 73 74 // Show the footer link 75 $(".set_footer").show(); 76 } else { 77 $(".set_footer").hide(); 78 } 79 }, 80 81 checkSetSpacing: function() { 82 $(".set_link").removeClass("first-set last-set spacer"); 83 84 var first_set = $(".set_link:first"), 85 last_set = $(".set_link:last"); 86 87 first_set.addClass("first-set"); 88 last_set.addClass("last-set"); 89 90 if (Cargo.Model.DisplayOptions.attributes.use_set_links) { 91 var setLinksPosition = Cargo.Model.DisplayOptions.GetSetLinksPosition(); 92 93 if (first_set.attr("id") == last_set.attr("id")) { 94 // Only one set 95 if (setLinksPosition == "top") { 96 last_set.addClass("spacer").removeClass("first-set"); 97 } else if (setLinksPosition == "bottom") { 98 first_set.addClass("spacer"); 99 } 100 } else { 101 if (setLinksPosition == "top") { 102 last_set.addClass("spacer"); 103 } else if (setLinksPosition == "bottom") { 104 first_set.add(last_set).addClass("spacer"); 105 } 106 } 107 } 108 } 109}; 110 111/** 112 * Events 113 */ 114 115$(function() { 116 Cargo.Core.ReplaceLoadingAnims.init(); 117 118 Design.bindKeys(); 119 Design.hoverProject(); 120 Design.checkSetSpacing(); 121 Design.checkNavigationHeight(); 122}); 123 124// Window Resize 125$(window).resize(function() { 126 Design.checkNavigationHeight(); 127}); 128 129// Project Load Complete 130Cargo.Event.on("project_load_complete", function(pid) { 131 Design.checkSetVisibility(); 132 133 /* 134 * Move the project navigation if the default image width is > 670px. 135 */ 136 137 var defaultImageWidth = parseInt(Cargo.Model.DisplayOptions.GetImageWidth()); 138 139 if (defaultImageWidth < 670) { 140 defaultImageWidth = 670; 141 } 142 143 defaultImageWidth += 305; 144 145 $(".project_navigation").css("left", defaultImageWidth + "px"); 146}); 147 148// Project Close Complete 149Cargo.Event.on("show_index_complete", function(pid) { 150 setTimeout(function() { 151 // Reset sets 152 $("[data-setid]").removeClass("active inactive"); 153 $(".set_footer").hide(); 154 }, 20); 155}); 156 157Cargo.Event.on("navigation_reset", function(new_page) { 158 Design.checkSetSpacing(); 159}); 160 161Cargo.Event.on("navigation_set_toggle", function() { 162 Design.checkNavigationHeight(); 163}); 164 165// Pagination 166Cargo.Event.on("pagination_complete", function(new_page) { 167 Design.checkSetVisibility(); 168 Design.checkSetSpacing(); 169 window.setTimeout(function() { 170 Design.checkNavigationHeight(); 171 }, 10); 172}); 173 174Cargo.Event.on("project_collection_reset", function(new_page) { 175 Design.checkSetVisibility(); 176 Design.checkSetSpacing(); 177 window.setTimeout(function() { 178 Design.checkNavigationHeight(); 179 }, 10); 180}); 181 182Cargo.Event.on("fullscreen_destroy_hotkeys", function() { 183 Design.bindKeys(); 184}); 185 186/** 187 * Typography 188 */ 189 190WebFontConfig = { 191 // google: { families: ["Istok+Web:400,700,400italic,700italic:latin"] } 192}; 193 194(function() { 195 var wf = document.createElement("script"); 196 wf.src = ("https:" == document.location.protocol ? "https" : "http") + "://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"; 197 wf.type = "text/javascript"; 198 wf.async = "true"; 199 var s = document.getElementsByTagName("script")[0]; 200 s.parentNode.insertBefore(wf, s); 201})();
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.