1/** 2 * Friedman 3 */ 4 5var Design = { 6 7 keybindings: function() { 8 // Remove previous bindings 9 Cargo.Core.KeyboardShortcut.Remove("Left"); 10 Cargo.Core.KeyboardShortcut.Remove("Right"); 11 12 Cargo.Core.KeyboardShortcut.Add("esc", 27, function() { 13 Action.Project.Close(); 14 return false; 15 }); 16 17 Cargo.Core.KeyboardShortcut.Add("Left", 37, function() { 18 Action.Project.Prev(); 19 return false; 20 }); 21 22 Cargo.Core.KeyboardShortcut.Add("Right", 39, function() { 23 Action.Project.Next(); 24 return false; 25 }); 26 }, 27 28 resizeSlideshow: function(el, obj, state) { 29 if (state == "resize") { 30 el.find("> *").css({ 31 "-webkit-transition": "margin 0s ease", 32 "-moz-transition": "margin 0s ease", 33 "transition": "margin 0s ease" 34 }); 35 } else { 36 el.find("> *").css({ 37 "-webkit-transition": "margin " + obj.options.transition_duration + "s ease", 38 "-moz-transition": "margin " + obj.options.transition_duration + "s ease", 39 "transition": "margin " + obj.options.transition_duration + "s ease" 40 }); 41 } 42 43 // Resize and position the containing element 44 obj.resizeContainer(); 45 Cargo.Plugins.elementResizer.refresh(); 46 }, 47 48 groupNavigation: function() { 49 var navGroups = []; 50 51 $(".navigation div[data-type]").each(function() { 52 var type = this.getAttribute("data-type"); 53 54 if ($.inArray(type, navGroups) == -1) { 55 // first unwrap if already wrapped 56 if ($(this).parent().hasClass("group")) { 57 $(this).unwrap(); 58 } 59 60 if (type == "link" || type == "page") { 61 var items = $(".navigation div[data-type='link'], .navigation div[data-type='page']"); 62 navGroups.push("link", "page"); 63 } else { 64 var items = $(".navigation div[data-type='" + type + "']"); 65 navGroups.push(type); 66 } 67 68 items.wrapAll("<span class='group' />"); 69 } 70 }); 71 }, 72 73 adjustHeader: function () { 74 75 //Move Header Img / Text with height of nav 76 $(window).on("load resize", function() { 77 78 var navHeight = $('.navigation').height(), 79 navHeightHalf = navHeight / 2; 80 headImgWrap = $('.site_header'); 81 82 if (!Cargo.Helper.isPhone() && navHeight > 33 && headImgWrap.is(':visible')) { 83 84 headImgWrap.css('margin-top', navHeightHalf); 85 86 } else if (!Cargo.Helper.isPhone() && navHeight <= 33 && headImgWrap.is(':visible')) { 87 88 headImgWrap.removeAttr('style'); 89 90 } 91 92 }); 93 94 }, 95 96 formatThumbnails: function() { 97 $(".thumbnail[data-formatted!='true']").each(function() { 98 if ($(this).find(".thumb_image img").attr("src") == "/_gfx/thumb_custom.gif") { 99 $(this).addClass("default_thumb"); 100 } 101 102 $(this).attr("data-formatted", "true"); 103 }); 104 }, 105 106 mobileIcons: function() { 107 if (navigator.userAgent.match(/i(Phone|Pod|Pad)/i)) { 108 $(".goto.prev").text("â²"); 109 $(".goto.next").text("â¼"); 110 $(".project_nav .previous").text("â"); 111 $(".project_nav .next").text("â"); 112 } 113 }, 114 115 formatNavigation : function() { 116 $('.navigation .page_link').appendTo('.page_navigation'); 117 }, 118 119 setActiveState : function() { 120 121 // Ignore if we're not on a set 122 if ( !Cargo.Helper.IsOnSet() ) return false; 123 124 $('.sets > div[data-title="' + Cargo.Helper.GetSetName() + '"]').addClass('active'); 125 126 } 127 128}; 129 130/** 131 * Events 132 */ 133 134$(function() { 135 136 // Design.mobileIcons(); 137 Design.keybindings(); 138 Design.formatThumbnails(); 139 Design.formatNavigation(); 140 Design.setActiveState(); 141 Design.adjustHeader(); 142 143 // divide the nav in groups 144 Design.groupNavigation(); 145 146 if(Cargo.Helper.IsSololink() || Cargo.Helper.IsOnStartProject()) { 147 setTimeout(Site.Project.loadComplete, 50); 148 // var pid = (Cargo.Model.Project.GetId()) ? Cargo.Model.Project.GetId() : Cargo.Helper.GetStartProjectId(); 149 // if($('[data-id="'+pid+'"].active', Cargo.View.Navigation.$el).length > 0) { 150 // $('[data-id="'+pid+'"].active', Cargo.View.Navigation.$el).parents('.group').remove(); 151 // } 152 153 if(Cargo.Model.Project.GetType() === "project") { 154 // Hide the header 155 $('.site_header').hide(); 156 } 157 } 158 159 // Note that we're on a phone 160 var md = new MobileDetect(window.navigator.userAgent); 161 if(md.mobile() && !md.tablet()) { 162 $("body").addClass("phone"); 163 } 164 165 var viewport = document.getElementById('viewport'); 166 if (Cargo.Helper.isPhone()) { 167 if(window.orientation != 0 && Cargo.Helper.isPhone()) { 168 viewport.setAttribute("content", "initial-scale=1"); 169 } else { 170 viewport.setAttribute("content", "initial-scale=0.55"); 171 } 172 } 173 174 175 window.addEventListener("orientationchange", function() { 176 177 if ( Cargo.Helper.isPhone()) { 178 if(window.orientation != 0 && Cargo.Helper.isPhone()) { 179 viewport.setAttribute("content", "initial-scale=1"); 180 } else { 181 viewport.setAttribute("content", "initial-scale=0.55"); 182 } 183 } 184 185 }, false); 186}); 187 188 189Cargo.Event.on("element_resizer_init", function( plugin ) { 190 plugin.setOptions({ 191 cargo_refreshEvents: ['projectContentFormatted', 'projectMediaFormatted', 'show_index_complete', 'pagination_complete', 'inspector_preview', 'project_collection_reset', 'direct_link_loaded'], 192 centerElements: false, 193 adjustElementsToWindowHeight: false, 194 }); 195}); 196 197Cargo.Event.on("slideshow_resize", function(el, obj) { 198 Design.resizeSlideshow(el, obj, "resize"); 199}); 200 201Cargo.Event.on("slideshow_transition_start", function(el, obj) { 202 Design.resizeSlideshow(el, obj); 203}); 204 205Cargo.Event.on("fullscreen_destroy_hotkeys", function() { 206 Design.keybindings(); 207}); 208 209Cargo.Event.on("project_load_complete", function(pid) { 210 // Design.mobileIcons(); 211 212 if (Cargo.Model.Project.GetType() == "project") { 213 if (!Cargo.Model.DisplayOptions.attributes.thumbs_below_projects || Cargo.Helper.IsOnSet()) { 214 // $(".show_index").show(); 215 } 216 } 217}); 218 219Cargo.Event.on("show_index_complete", function(pid) { 220 // $(".show_index").hide(); 221}); 222 223Cargo.Event.on("pagination_complete", function() { 224 Design.formatThumbnails(); 225 Design.groupNavigation(); 226}); 227 228Cargo.Event.on("navigation_reset", function() { 229 Design.groupNavigation(); 230});
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.