PageSourceSearch

https://rara-kyoto.jp/static/js/txg.js

js rara-kyoto.jp collected 2026-10-10 02:27:47 UTC 8,472 bytes, 247 lines download raw bytes

1
2/*
3  txg
4  ver. 1.0.0
5  require jQuery http: //jquery.com/
6  require colorbox
7 */
8
9(function() {
10  var _ref;
11
12  if (this.txg == null) {
13    this.txg = {
14      Version: '1.0.0',
15      Debug: false
16    };
17  }
18
19  if (((_ref = this.txg) != null ? _ref.img : void 0) == null) {
20    this.txg.img = (function($) {
21      var colorBoxOptions, htmlUnescape, nivoOptions;
22      htmlUnescape = function(s) {
23        return s.replace(/&amp;/g, '&').replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&quot;/g, '"').replace(/&#039;/g, "'");
24      };
25      colorBoxOptions = {
26        maxWidth: "75%",
27        maxHeight: "75%",
28        current: "{current}枚目/{total}枚中",
29        previous: "前",
30        next: "次",
31        close: "閉じる",
32        slideshowSpeed: 2500,
33        slideshowAuto: true,
34        slideshowStart: "開始",
35        slideshowStop: "停止",
36        title: function() {
37          return htmlUnescape($(this).attr('title'));
38        },
39        onComplete: function() {
40          if ($.mobile) {
41            $('#cboxLoadedContent').bind('swipeleft', function(e) {
42              $.colorbox.next();
43              e.stopImmediatePropagation();
44              return false;
45            });
46            return $('#cboxLoadedContent').bind('swiperight', function(e) {
47              $.colorbox.prev();
48              e.stopImmediatePropagation();
49              return false;
50            });
51          } else {
52            return $('#cboxLoadedContent').swipe({
53              swipe: function(e, direction) {
54                if (direction === 'right') {
55                  $.colorbox.prev();
56                }
57                if (direction === 'left') {
58                  return $.colorbox.next();
59                }
60              }
61            });
62          }
63        }
64      };
65      nivoOptions = {
66        effect: 'random',
67        slices: 15,
68        boxCols: 8,
69        boxRows: 4,
70        animSpeed: 500,
71        pauseTime: 3000,
72        startSlide: 0,
73        randomStart: false,
74        directionNav: true,
75        directionNavHide: true,
76        controlNav: true,
77        pauseOnHover: true,
78        manualAdvance: false,
79        prevText: '前',
80        nextText: '次'
81      };
82      return {
83        isSmartphone: function(ua) {
84          if (ua == null) {
85            ua = null;
86          }
87          if (ua === null) {
88            ua = navigator.userAgent;
89          }
90          return ua.indexOf('iPhone') > 0 || ua.indexOf('iPod') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0;
91        },
92        renderModeSetup: function() {
93          return $(function() {
94            if ($.mobile || window.txspmode) {
95              $('#footer').append(" <div id=\"render-mode-switch\" data-role=\"navbar\">\n   <ul>\n     <li>\n       <a id=\"tx-switch-pc\" class=\"switch-pc\" data-theme=\"b\">  PC</a>\n    </li>\n     <li>\n       <a class=\"render-mode-sp ui-btn-active\" data-theme=\"b\"> スマートフォン</a>\n    </li>\n  </ul>\n</div>");
96              if (!window.txspmode) {
97                $('#footer').page();
98              }
99              return $('#tx-switch-pc').click(function() {
100                return $.getJSON('/api/render_mode', {
101                  mode: 'pc'
102                }, function() {
103                  return location.reload();
104                });
105              });
106            } else {
107              if (txg.img.isSmartphone()) {
108                $('body').append('<div class="render-mode-switch"> <span class="render-mode-pc">PC</span> | <span class="render-mode-sp"><a id="tx-switch-sp" class="switch-sp">スマートフォン</a></span> </div>');
109                return $('#tx-switch-sp').click(function() {
110                  return $.getJSON('/api/render_mode', {
111                    mode: 'sp'
112                  }, function() {
113                    return location.reload();
114                  });
115                });
116              }
117            }
118          });
119        },
120        tgallery: function(sel) {
121          if (sel == null) {
122            sel = '.txg-tgallery-wrapper';
123          }
124          return $(function() {
125            return $(sel).each(function(idx) {
126              var options;
127              if ($(this).data('popup')) {
128                options = {
129                  rel: "txg-tgallery" + idx
130                };
131                $.extend(options, colorBoxOptions);
132                return $(this).find('a').filter(function() {
133                  return $(this).attr('href').match(/\.(jpg|jpeg|gif|png)(\?_render_=(sp|pc|mb))?$/i);
134                }).colorbox(options);
135              } else {
136                return $(this).find('a.txg-tgallery-image').click(function() {
137                  return false;
138                });
139              }
140            });
141          });
142        },
143        tgallerySlide: function(sel) {
144          if (sel == null) {
145            sel = '.txg-tgalleryslide-wrapper';
146          }
147          return $(function() {
148            return $(sel).each(function(idx) {
149              var options;
150              options = {
151                rel: "txg-tgalleryslide" + idx,
152                slideshow: true
153              };
154              $.extend(options, colorBoxOptions);
155              return $(this).find('a').filter(function() {
156                return $(this).attr('href').match(/\.(jpg|jpeg|gif|png)(\?_render_=(sp|pc|mb))?$/i);
157              }).colorbox(options);
158            });
159          });
160        },
161        doclist: function(sel) {
162          if (sel == null) {
163            sel = '.txg-doclist';
164          }
165          return $(function() {
166            return $(sel).each(function(idx) {
167              var curr, gdoclink, options;
168              curr = $(this);
169              options = {
170                width: curr.data('width'),
171                height: curr.data('height')
172              };
173              gdoclink = curr.data('gdoclink');
174              curr.find('.txg-doclist-embed').gdocsViewer(options);
175              if (gdoclink) {
176                return curr.find("a").click(function() {
177                  var link;
178                  link = $(this).data('link');
179                  $(this).attr('href', link);
180                  return true;
181                });
182              }
183            });
184          });
185        },
186        nivoslider: function(sel) {
187          if (sel == null) {
188            sel = '.txg-nivoslider';
189          }
190          return $(function() {
191            return $(sel).each(function(idx) {
192              var curr, options;
193              curr = $(this);
194              options = {
195                effect: curr.data('effect'),
196                slices: curr.data('slices'),
197                boxCols: curr.data('boxcols'),
198                boxRows: curr.data('boxraws'),
199                animSpeed: curr.data('animspeed'),
200                pauseTime: curr.data('pausetime'),
201                startSlide: curr.data('startslide'),
202                randomStart: curr.data('randomstart'),
203                directionNav: curr.data('dirnav'),
204                directionNavHide: curr.data('dirnavhide'),
205                controlNav: curr.data('controlnav'),
206                pauseOnHover: curr.data('pauseonhover'),
207                manualAdvance: curr.data('manualadvance'),
208                prevText: curr.data('prevtext'),
209                nextText: curr.data('nexttext')
210              };
211              curr.nivoSlider(options);
212              if ($.mobile) {
213                curr.bind('swipeleft', function(e) {
214                  $('a.nivo-nextNav').trigger('click');
215                  e.stopImmediatePropagation();
216                  return false;
217                });
218                return curr.bind('swiperight', function(e) {
219                  $('a.nivo-prevNav').trigger('click');
220                  e.stopImmediatePropagation();
221                  return false;
222                });
223              } else {
224                return curr.swipe({
225                  swipe: function(e, direction) {
226                    if (direction === 'right') {
227                      $('a.nivo-prevNav').trigger('click');
228                    }
229                    if (direction === 'left') {
230                      return $('a.nivo-nextNav').trigger('click');
231                    }
232                  }
233                });
234              }
235            });
236          });
237        }
238      };
239    })(jQuery);
240    this.txg.img.tgallery();
241    this.txg.img.tgallerySlide();
242    this.txg.img.nivoslider();
243    this.txg.img.doclist();
244    this.txg.img.renderModeSetup();
245  }
246
247}).call(this);

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.