PageSourceSearch

https://gumpla.jp/wp-content/themes/gush/assets/js/common-post.js?27153238

js gumpla.jp collected 2026-10-03 22:14:05 UTC 8,512 bytes, 242 lines download raw bytes

1// selectbox
2$("select").wrap('<div class="c-form__select">');
3$(function () {
4  $(".add-link").each(function () {
5    $(this).html(
6      $(this)
7        .html()
8        .replace(/((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g, '<a class="u-link__text" href="$1" target="_blank" rel="noopener noreferrer nofollow">$1</a> ')
9    );
10  });
11});
12
13// autosize
14function addAutoResize() {
15  document.querySelectorAll("[data-autoresize]").forEach(function (element) {
16    element.style.boxSizing = "border-box";
17    var offset = element.offsetHeight - element.clientHeight;
18    element.addEventListener("input", function (event) {
19      event.target.style.height = "auto";
20      event.target.style.height = event.target.scrollHeight + offset + "px";
21    });
22    element.removeAttribute("data-autoresize");
23  });
24}
25addAutoResize();
26
27// darkcheck
28const darkForm = document.querySelector(".c-drawer-menu__dark form");
29if (darkForm !== null) {
30  darkForm.addEventListener("change", function (e) {
31    $(this).closest("form").submit();
32    if ($(".wpuf_dark_mode_618144").prop("checked") == true) {
33      document.documentElement.setAttribute("mode", "dark");
34    } else {
35      document.documentElement.removeAttribute("mode", "dark");
36    }
37  });
38  $(function () {
39    $(".c-drawer-menu__dark .wpuf-checkbox-block").before('<span class="darkmode_switch"></span>');
40  });
41}
42
43// darkcheck
44function addChangeEventListener(formSelector) {
45  const form = document.querySelector(formSelector + " form");
46  if (form !== null) {
47    form.addEventListener("change", function (e) {
48      $(this).closest("form").submit();
49    });
50  }
51}
52const formSelectors = [".formcheck1", ".formcheck2", ".formcheck3", ".formcheck4", ".formcheck5", ".formcheck6", ".formcheck7", ".formcheck8"];
53formSelectors.forEach(function (selector) {
54  addChangeEventListener(selector);
55});
56
57$('.p-post-moment input[value="high"]').prop("checked", true);
58$("li.update_level").hide();
59
60$(document).ready(function () {
61  var currentURL = window.location.href;
62  if (currentURL.indexOf("moment-post") !== -1) {
63    function updateTagValues(tagName) {
64      var tagCopyVal = $("#tag-copy").val();
65      var tagsVal = $("#tags").val();
66      if (tagCopyVal !== "") {
67        tagCopyVal += "," + tagName;
68      } else {
69        tagCopyVal = tagName;
70      }
71      if (tagsVal !== "") {
72        tagsVal += "," + tagName;
73      } else {
74        tagsVal = tagName;
75      }
76      $("#tag-copy").val(tagCopyVal);
77      $("#tags").val(tagsVal);
78    }
79    $(".osusume-tag .c-tag__list-link").click(function () {
80      var tagName = $(this).text();
81      var tagLink = $(this);
82      if (!tagLink.hasClass("active")) {
83        tagLink.addClass("active");
84        updateTagValues(tagName);
85      } else {
86        tagLink.removeClass("active");
87        var removedTagName = tagName;
88        var tagCopyVal = $("#tag-copy").val();
89        var tagsArray = tagCopyVal.split(",");
90        var updatedTagsArray = tagsArray.filter(function (tag) {
91          return tag.trim() !== removedTagName.trim();
92        });
93        var updatedTagCopyVal = updatedTagsArray.join(",");
94        $("#tag-copy").val(updatedTagCopyVal);
95        var tagsVal = $("#tags").val();
96        var updatedTagsVal = tagsVal
97          .split(",")
98          .filter(function (tag) {
99            return tag.trim() !== removedTagName.trim();
100          })
101          .join(",");
102        $("#tags").val(updatedTagsVal);
103      }
104      $(document).on("click", ".tagit-close", function () {
105        var removedTagName = $(this).closest(".tagit-choice").find(".tagit-label").text(); // 削除されるタグのテキストを取得
106        $(this).closest(".tagit-choice").remove();
107        var tagCopyVal = $("#tag-copy").val();
108        var tagsArray = tagCopyVal.split(",");
109        var updatedTagsArray = tagsArray.filter(function (tag) {
110          return tag.trim() !== removedTagName.trim();
111        });
112        var updatedTagCopyVal = updatedTagsArray.join(",");
113        $("#tag-copy").val(updatedTagCopyVal);
114        var tagsVal = $("#tags").val();
115        var tagsArray = tagsVal.split(",");
116        var updatedTagsArray = tagsArray.filter(function (tag) {
117          return tag.trim() !== removedTagName.trim();
118        });
119        var updatedTagsVal = updatedTagsArray.join(",");
120        $("#tags").val(updatedTagsVal);
121      });
122    });
123    $(".p-post-moment .osusume-tag").each(function () {
124      $(this).appendTo($(this).parent().find(".tag-copy"));
125    });
126  } else if (currentURL.indexOf("post") !== -1) {
127  } else {
128    function updateTagValues(tagName) {
129      var tagCopyVal = $("#tag-copy").val();
130      var tagsVal = $("#tags").val();
131      if (tagCopyVal !== "") {
132        tagCopyVal += "," + tagName;
133      } else {
134        tagCopyVal = tagName;
135      }
136      if (tagsVal !== "") {
137        tagsVal += "," + tagName;
138      } else {
139        tagsVal = tagName;
140      }
141      $("#tag-copy").val(tagCopyVal);
142      $("#tags").val(tagsVal);
143    }
144    $(".osusume-tag .c-tag__list-link").click(function () {
145      var tagName = $(this).text();
146      var tagLink = $(this);
147      if (!tagLink.hasClass("active")) {
148        tagLink.addClass("active");
149        updateTagValues(tagName);
150      } else {
151        tagLink.removeClass("active");
152        var removedTagName = tagName;
153        var tagCopyVal = $("#tag-copy").val();
154        var tagsArray = tagCopyVal.split(",");
155        var updatedTagsArray = tagsArray.filter(function (tag) {
156          return tag.trim() !== removedTagName.trim();
157        });
158        var updatedTagCopyVal = updatedTagsArray.join(",");
159        $("#tag-copy").val(updatedTagCopyVal);
160        var tagsVal = $("#tags").val();
161        var updatedTagsVal = tagsVal
162          .split(",")
163          .filter(function (tag) {
164            return tag.trim() !== removedTagName.trim();
165          })
166          .join(",");
167        $("#tags").val(updatedTagsVal);
168      }
169      $(document).on("click", ".tagit-close", function () {
170        var removedTagName = $(this).closest(".tagit-choice").find(".tagit-label").text(); // 削除されるタグのテキストを取得
171        $(this).closest(".tagit-choice").remove();
172        var tagCopyVal = $("#tag-copy").val();
173        var tagsArray = tagCopyVal.split(",");
174        var updatedTagsArray = tagsArray.filter(function (tag) {
175          return tag.trim() !== removedTagName.trim();
176        });
177        var updatedTagCopyVal = updatedTagsArray.join(",");
178        $("#tag-copy").val(updatedTagCopyVal);
179        var tagsVal = $("#tags").val();
180        var tagsArray = tagsVal.split(",");
181        var updatedTagsArray = tagsArray.filter(function (tag) {
182          return tag.trim() !== removedTagName.trim();
183        });
184        var updatedTagsVal = updatedTagsArray.join(",");
185        $("#tags").val(updatedTagsVal);
186      });
187    });
188    $(".p-post-moment .osusume-tag").each(function () {
189      $(this).appendTo($(this).parent().find(".tag-copy"));
190    });
191  }
192});
193$(document).on("DOMContentLoaded", function () {
194  $("input.ui-widget-content").on("focus", function () {
195    $("ul.singleFieldTags").addClass("focused");
196  });
197
198  $("input.ui-widget-content").on("blur", function () {
199    $("ul.singleFieldTags").removeClass("focused");
200  });
201});
202
203$(function () {
204  var $fileSelector = $(".wpuf-multiple .file-selector");
205  var $attachmentList = $(".wpuf-multiple .wpuf-attachment-list");
206
207  // .file-selectorを<li>
207で囲んで、.wpuf-attachment-listの最後に追加
208  $fileSelector.wrap('<div class="wpuf-image-wrap wpuf-add-image">').insertAfter($attachmentList);
209});
210function updateListClass() {
211  var fileSelector = $(".wpuf-multiple .wpuf-attachment-upload-filelist .file-selector");
212  var liCount = $(".wpuf-multiple .wpuf-attachment-list.thumbnails li").length;
213
214  if (liCount > 0) {
215    fileSelector.addClass("u-spacer__top--md wpuf-important");
216  } else {
217    fileSelector.removeClass("u-spacer__top--md wpuf-important");
218  }
219
220  if (liCount >= 6) {
221    fileSelector.removeClass("u-spacer__top--md wpuf-important");
222  }
223}
224
225var observer = new MutationObserver(function (mutations) {
226  mutations.forEach(function (mutation) {
227    if (mutation.addedNodes.length || mutation.removedNodes.length) {
228      updateListClass();
229    }
230  });
231});
232
233$(document).ready(function () {
234  updateListClass();
235
236  var targetNode = document.querySelector(".wpuf-multiple .wpuf-attachment-upload-filelist");
237
238  if (targetNode) {
239    var config = { childList: true, subtree: true };
240    observer.observe(targetNode, config);
241  }
242});

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.