PageSourceSearch

https://tinyvoice.com/wp-content/themes/tinyvoice/js/flag.js?ver=1787207819

js tinyvoice.com collected 2026-10-02 19:10:12 UTC 11,418 bytes, 392 lines download raw bytes

1$(function () {
2
3
4  //Posts
5  $(function () {
6
7    var mobile = false;
8    var ua = navigator.userAgent;
9    if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPod') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0) {
10      mobile = true;
11    }
12
13    function onPlayerReady(event) {
14      if (mobile) {
15        event.target.mute();
16      }
17      event.target.playVideo();
18    }
19    $('.thumb-wrap').click(function () {
20      var video_id = $(this).children('.thumb').data('video');
21      var player_id = $(this).next().attr('id');
22      var video_type = $(this).children('.thumb').data('type');
23      if (video_type == 'youtube') {
24        player = new YT.Player(player_id, {
25          height: '315',
26          width: '560',
27          playerVars: {
28            playsinline: 1
29          },
30          videoId: video_id,
31          events: {
32            'onReady': onPlayerReady,
33          }
34        });
35        $(this).hide();
36      }
37      if (video_type == 'vimeo') {
38        var player = new Vimeo.Player($('#' + player_id), {
39          id: video_id,
40          width: '560',
41        });
42        $(player).trigger('play');
43        $(this).hide();
44      }
45    });
46  });
47
48  // youtube / vimeo / nicovideに対応
49  function getVideoType(url) {
50
51    var type;
52    var id;
53    var src;
54
55    if (1 <= url.indexOf('youtube')) {
56      type = 'youtube';
57      id = url.match(/\?v=([^&]+)/);
58      src = 'https://www.youtube.com/embed/' + id[1];
59    }
60
61    if (1 <= url.indexOf('vimeo')) {
62      type = 'vimeo';
63      id = url.match(/[0-9]+$/);
64      src = 'https://player.vimeo.com/video/' + id[0] + '?title=0&byline=0&portrait=0';
65    }
66
67    if (1 <= url.indexOf('nicovideo')) {
68      type = 'nicovideo';
69      id = url.match(/\/watch\/([^\/]*)/);
70      src = 'https://embed.nicovideo.jp/watch/' + id[1];
71    }
72
73    return {
74      'type': type,
75      'id': id,
76      'src': src
77    }
78  }
79
80  $(function () {
81    $('.reply-comment-body').on('change keydown keyup paste cut', 'textarea', function () {
82      $('.post-comment').height(0).height(this.scrollHeight);
83      if ($(this).height() >= 300) {
84        $('.post-comment').css("overflow", "auto");
85      }
86      else {
87        $('.post-comment').css("overflow", "hidden");
88      }
89    }).find('.post-comment').change();
90  });
91
92  $(function () {
93    $('.postinner-like,.postinner-comment-like').click(function () {
94      $(this).addClass("postinner-liked");
95    });
96
97    $('.table-more').click(function () {
98      if ($(this).find(".more-popup,.popup-triangle").is(":visible")) {
99        $(".more-popup,.popup-triangle").fadeOut();
100      } else {
101        $(".more-popup,.popup-triangle").fadeOut();
102        $(this).find(".more-popup,.popup-triangle").fadeIn();
103      }
104    });
105
106    $('.reply-comment-button').click(function () {
107      $(this).parents('.postinner-comment').find('.reply-comment').toggleClass("switchon");
108      $(this).parents('.postinner-comment').find('.post-comment').focus();
109    });
110
111    $('.switch-button').click(function () {
112      $(this).parents('.switch-wrap').next().toggleClass("switchoff");
113      $(this).parents('.switch-wrap').siblings('.switch-on').toggleClass("switchon");
114    });
115
116    $('.other-receiver').click(function () {
117      $('.hide-field-wrap').slideToggle();
118    });
119
120  });
121
122  $(".tab_content").hide();
123  $(".tab_content:first").show();
124
125  //tab mode
126
127  $(".tabs .tab, .tabs .tab-wrap").click(function () {
128
129    $(".tab_content").hide();
130    var activeTab = $(this).attr("rel");
131    $("#" + activeTab).show();
132    $(".tabs .tab, .tabs .tab-wrap").removeClass("tab-active");
133    $(this).addClass("tab-active");
134
135    $(".tab-accordion_heading").removeClass("d_active");
136    $(".tab-accordion_heading[rel^='" + activeTab + "']").addClass("d_active");
137
138
139    target = $('.page-store-menu');
140    $('html,body').animate({
141      scrollTop: target.offset().top - 100
142    }, 100);
143
144  });
145
146  /* acoordion mode */
147
148  $(".tab-accordion_heading").click(function () {
149
150    $(".tab_content").hide();
151    var d_activeTab = $(this).attr("rel");
152    $("#" + d_activeTab).fadeIn();
153
154    $(".tab-accordion_heading").removeClass("d_active");
155    $(this).addClass("d_active");
156
157    $(".tab-accordion_heading").removeClass("tab-active");
158    $(".tab-accordion_heading[rel^='" + d_activeTab + "']").addClass("tab-active");
159
160    if ($(this).hasClass("d_active")) {
161      $(this).removeClass("d_active");
162      $("#" + d_activeTab).fadeIn();
163    }
164
165    target = $('.tab-accordion_heading.tab-active');
166    $('html,body').animate({
167      scrollTop: target.offset().top - 100
168    }, 100);
169
170
171  });
172
173  //Community
174  $(function () {
175    $("#survey").on("click", function () {
176      if($("#survey_form tbody tr").length > 10) {
177        window.alert("アンケートは10個までです。");
178        return false;
179      }
180      $("#survey_form tbody tr:first-child").clone(true).appendTo("#survey_form tbody");
181
182      $("#survey_form tbody tr:last-child").css("display", "block");
183
184      $(".surveydelete").on("click", function () {
185        $(this).parent().parent().remove();
186      });
187    });
188  });
189
190
191  //Shop
192  $(function () {
193    if ($('.shop-image-slider').length) {
194      $('.shop-image-slider').slick({
195        autoplay: false,
196		infinite: false,
197        dots: true,
198        arrows: true,
199        prevArrow: $('.arrow-left'),
200        nextArrow: $('.arrow-right'),
201        customPaging: function (slider, i) {
202          var thumb = $(slider.$slides[i]).data('thumb');
203          return '<img class="shop-sub-image" src="' + thumb + '" loading="lazy"/>';
204        }
205      });
206    }
207  });
208
209  //種類によって在庫数を動的に切り替える
210  $(function () {
211    $('#FlagGoodsType').change(function () {
212      var amount;
213      $('#FlagGoodsQuantity').children().remove();
214      $.each(data, function (index, val) {
215        if (val['id'] == $('#FlagGoodsType').val()) {
216          amount = val['amount'];
217        }
218      });
219      for (var i = 1; i <= amount; i++) {
220        $('#FlagGoodsQuantity').append($('<option value="' + i + '">' + i + '</option>'));
221      }
222    });
223  });
224
225//   $(function () {
226
227//     var
228//       $form_header = $('.creatorpage-purchase-form'),
229//       productprice = $('.creatorpage-productprice'),
230//       header_height = $form_header.height(),
231//       offset_val = $form_header.outerHeight() + $form_header.offset().top;
232
233
234//     // Methods
235//     // =================================================
236
237//     function navSlide() {
238//       var scroll_top = $(window).scrollTop();
239
240//       if (scroll_top >= offset_val) {
241//         $form_header.addClass('bottom-sticky');
242//         productprice.css('margin-top', '75px');
243//       } else {
244//         $form_header.removeClass('bottom-sticky');
245//         productprice.css('margin-top', '0');
246//       }
247//     }
248
249//     $(window).scroll(navSlide);
250
251//   });
252
253  $('.adminbar-title-link').click(function () {
254    $('.adminbar-subtitle').fadeToggle();
255  });
256
257  $('.note-video-clip').parent('p').addClass('iframe-wrap');
258});
259
260$(function () {
261  function insertStr(input) {
262    return input.slice(0, 3) + '-' + input.slice(3, input.length);
263  }
264
265  $("#postalcode, #recipientpostalcode").on('keyup', function () {
266    var input = $(this).val();
267    var key = event.keyCode || event.charCode;
268    if (key == 8 || key == 46) {
269      return false;
270    }
271    if (input.length === 3) {
272      $(this).val(insertStr(input));
273    }
274    if ($(this).val().length == 8) {
275      $(this).closest('.payment-input').nextAll('.half').find('.input-content').focus();
276    }
277  });
278
279  $("#postalcode, #recipientpostalcode").on('blur', function () {
280    var input = $(this).val();
281    if (input.length >= 3 && input.substr(3, 1) !== '-') {
282      $(this).val(insertStr(input));
283    }
284    if ($(this).val() == '') {
285      $('#address').val('');
286    }
287  });
288
289  $("#tel, #recipienttel").on('blur', function () {
290    var val_old = $(this).val();
291    var newString = new libphonenumber.AsYouType('JP').input(val_old);
292    $(this).val('').val(newString);
293  });
294});
295
296$(function () {
297	$(document).ready(function(){
298  $.validator.addMethod("isZip", function (value, element) {
299    return this.optional(element) || /^\d{3}-?\d{4}$/.test(value);
300  }, '正しい形式で入力してください');
301
302  $.extend($.validator.messages, {
303    required: '必須項目です',
304    maxlength: '{0}字以下で入力してください',
305	email: 'メールアドレスの形式で入力してください'
306  });
307
308  $.validator.addMethod("isTel", function (value, element) {
309	return this.optional(element) || /^(0[5-9]0[0-9]{8}|0[1-9][1-9][0-9]{7})$/.test(value.replace(/[━.*‐.*―.*-.*\-.*ー.*\-]/gi, ''));
310  }, '正しい形式で入力してください');
311
312  $("#FlagGoodsUserCheckoutForm, #FlagAuctionUserCheckoutForm").validate({
313    errorElement: "p",
314    errorClass: "error-content",
315    rules: {
316      "data[FlagPayer][email]": {
317        email: true,
318      },
319      "data[FlagPayer][postalcode]": {
320        isZip: true,
321      },
322      "data[FlagRecipient][postalcode]": {
323        isZip: true,
324      },
325      "data[FlagPayer][tel]": {
326        isTel: true,
327      },
328      "data[FlagRecipient][tel]": {
329        isTel: true,
330      },
331    },
332  });
333
334  $("#FlagSupportUserJoinForm").validate({
335    errorElement: "p",
336    errorClass: "error-content",
337    rules: {
338      "data[FlagPayer][email]": {
339        email: true,
340      },
341      "data[FlagPayer][postalcode]": {
342        isZip: true,
343      },
344      "data[FlagRecipient][postalcode]": {
345        isZip: true,
346      },
347      "data[FlagPayer][tel]": {
348        isTel: true,
349      },
350      "data[FlagRecipient][tel]": {
351        isTel: true,
352      },
353    },
354  });
355});
356
357  $(document).on('click', function (e) {
358    if (!$(e.target).closest('.tooltip').length && !$(e.target).closest('.help-icon').length) {
359      $('.tooltip,.tooltip-triangle').fadeOut();
360    }
361  });
362
363  $('.help-icon').click(function () {
364    if ($(this).siblings(".tooltip,.tooltip-triangle").is(":visible")) {
365      $(".tooltip,.tooltip-triangle").fadeOut();
366    } else {
367      $(".tooltip,.tooltip-triangle").fadeOut();
368      $(this).siblings(".tooltip,.tooltip-triangle").fadeIn();
369    }
370  });
371});
372
373$(window).on('load', function () {
374  var url = $(location).attr('href');
375  if (url.indexOf("#") != -1) {
376    var anchor = url.split("#");
377    var target = $('#' + anchor[anchor.length - 1]);
378    if (target.length) {
379      // 固定ヘッダーの高さ(.banner{height:50px})ぶんだけ引く。
380      // 同一ページ内クリック時のスクロール処理(tinyvoice-main.jsのa[href*="#"]ハンドラ)は
381      // 既にこの -50 を使っており、他ページからハッシュ付きURLで直接遷移してきた
382      // 場合(=このload時ハンドラが担当するケース)だけ-120という異なる値になっていて、
383      // ヘッダー分を引ききれず対象セクションの上に前のセクションが見えてしまっていた。
384      //
385      // target.offset().topは行間などレイアウト由来の端数(小数px)を持つことがあり、
386      // Math.floorで切り捨てるとヘッダーの下にその端数ぶんの隙間ができ、前のセクションの
387      // 端が細い線状に見えてしまう。四捨五入して端数をヘッダー側(見えã
387ªã„側)に寄せる。
388      var pos = Math.round(target.offset().top) - 50;
389      $("html, body").animate({ scrollTop: pos }, 0);
390    }
391  }
392});

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.