PageSourceSearch

https://bambooculture.com/sites/d6.bambooculture.com/themes/bamboo2015/js/rwd.js

js bambooculture.com collected 2026-10-02 07:50:33 UTC 6,581 bytes, 197 lines download raw bytes

1if (typeof jq1110 !== 'undefined') {
2  (function($) {
3
4    "use strict";
5
6    // Get viewport
7    var viewport;
8    var getViewport = function() {
9      viewport = {
10        width  : $(window).width(),
11        height : $(window).height()
12      };
13    }
14    getViewport();
15
16    var lang;
17    var getLang = function() {
18      var r = location.pathname.split("/");
19      lang = r[1];
20    }
21    getLang();
22
23    // Mobile button click
24    var mobileBtnClick = function() {
25      $(".mbtn, .mlink").on("click", function(e) {
26        e.preventDefault();
27        var btnActive = $(this).hasClass("mbtn") ? "mbtn-active" : "mlink-active";
28        var panelOpen = "panel-open";
29        //$(".mbtn").not(this).removeClass(btnActive);
30        //var thisId = $(this).attr("id");
31        if ($(this).hasClass(btnActive)) {
32          // close
33          $(this).removeClass(btnActive);
34          if ($(".mbtn-active").length == 0 && $(".mlink-active").length == 0) {
35            $("body").removeClass(panelOpen);
36          }
37        } else {
38          // open
39          $(this).addClass(btnActive);
40          if ($(".mbtn-active").length > 0 || $(".mlink-active").length > 0) {
41            $("body").addClass(panelOpen);
42          }
43        }
44      });
45    }
46
47    var menuToDrop = function() {
48      // Create the dropdown base
49      $("<select />").insertAfter(".page-theme-title");
50
51      //var defaultText = $(".page-theme-title").length > 0 ? "瀏覽" + $(".page-theme-title").text() + "的其他內容" : "瀏覽其他內容";
52      var defaultText = $("body").hasClass("i18n-en") ? "Go to..." : "請選擇 ...";
53      // Create default option "Go to..."
54      $("<option />", {
55         "value"   : "",
56         "text"    : defaultText
57      }).appendTo(".page-theme-title + select");
58
59      // Populate dropdown with menu items
60      $(".theme-menu-block:first .menu li a").each(function() {
61        var el = $(this);
62        var attr = el.parent("li").attr("style");
63        if (attr === undefined) {
64          if (el.hasClass("active")) {
65            $("<option />", {
66              "selected": "selected",
67              "value"   : el.attr("href"),
68              "text"    : el.parent("li").parents("li.expanded").length > 0 ? "- " + el.text() : el.text()
69            }).appendTo(".page-theme-title + select");
70          } else {
71            $("<option />", {
72              "value"   : el.attr("href"),
73              "text"    : el.parent("li").parents("li.expanded").length > 0 ? "- " + el.text() : el.text()
74            }).appendTo(".page-theme-title + select");
75          }
76        }
77      });
78
79      $(".page-theme-title + select").change(function() {
80        if ($(this).val() != "") {
81          var hashname = $(this).val().split("#");
82          hashname.shift();
83          console.log(hashname);
84          if (hashname != "") {
85            var hash = "#" + hashname;
86            var hashOffset = $(hash).offset().top;
87            var headerHeight = $("#header").outerHeight();
88            var scrollPos = hashOffset - headerHeight;
89            $('html, body').animate({
90              scrollTop: scrollPos
91            }, 100);
92            location.hash = hash;
93          } else {
94            window.location = $(this).find("option:selected").val();
95          }
96        }
97      });
98    }
99
100    var crmFormElemsRebuild = function() {
101      if ($(".crm-section").length > 0) {
102        console.log("crmFormElemsRebuild !!!!");
103        $(".crm-section input.form-radio, .crm-section input.form-checkbox").each(function() {
104          var type = $(this).attr("type");
105          var classname = "crm-form-" + type;
106          if ($(this).parent("label").length > 0) {
107            console.log("1");
108            $(this).parent("label").addClass(classname);
109          }
110          else {
111            if ($(this).next("label").length > 0) {
112              console.log("2");
113              var $wrap = $(this).next("label");
114              $wrap.addClass(classname);
115              $wrap.html("<span class='crm-form-label'>" + $wrap.html() + "</span>");
116              $(this).prependTo($wrap);
117            }
118          }
119        });
120      }
121    }
122
123    var rwdEvent = function(vw) {
124      console.log(vw);
125      if (vw >= 768) {
126        // $(".search-box").insertAfter("#main-menu");
127        if ($("body").hasClass("front")) {
128          $("#block-views-2015_Article-block_1").prependTo("#content-bottom .limiter");
129        }
130        if ($("#block-netivism_bamboo-about_child_item").length > 0) {
131
132        }
133        if ($(".space-title").length > 0) {
134          $(".space-title").insertAfter(".space-gallery");
135        }
136      } else {
137        // $(".search-box").insertAfter("#mlink-search");
138        if ($("body").hasClass("front")) {
139          $("#block-views-2015_Article-block_1").insertBefore("#block-views-2015_Artist-block_1");
140        }
141        if ($("#block-netivism_bamboo-about_child_item").length > 0) {
142          if ($("#content-middle #block-netivism_bamboo-about_child_item").length == 0) {
143            $("#block-netivism_bamboo-about_child_item").insertAfter($("#content-middle .node"));
144          }
145        }
146        if ($(".theme-menu-block").length > 0 && $(".page-theme-title + select").length == 0) {
147          menuToDrop();
148        }
149        if ($(".crm-event-title").length > 0) {
150          $(".crm-event-title").insertBefore(".crm-event-img");
151        }
152        if ($(".space-title").length > 0) {
153          $(".space-title").insertBefore(".space-gallery");
154        }
155      }
156    }
157
158    var mMenuItemClick = function() {
159      $(".sidr li a").on("click", function() {
160        if (this.hash) {
161          if (this.pathname == window.location.pathname) {
162            var msID = $(this).closest(".sidr").attr("id");
163            $("a[href='#"+msID+"']").click();
164          }
165        }
166      });
167    }
168
169    // Document ready
170    $(document).ready(function() {
171      mobileBtnClick();
172      rwdEvent(viewport.width);
173      mMenuItemClick();
174    });
175
176    $(window).load(function() {
177      crmFormElemsRebuild();
178    });
179
180    // Window resize
181    var resizeTimer;
182    var windowResize = function() {
183      getViewport();
184      rwdEvent(viewport.width);
185    };
186
187    $(window).resize(function() {
188        clearTimeout(resizeTimer);
189        resizeTimer = setTimeout(windowResize, 250);
190    });
191
192    $(window).scroll(function() {
193      var scroll = $(window).scrollTop();
194    });
195
196  })(jq1110);
197}

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.