PageSourceSearch

https://www.wacoal.jp/common_wacoal_jp/js/common.js

js wacoal.jp collected 2026-09-24 08:39:38 UTC 11,667 bytes, 359 lines download raw bytes

1//  Drop Console
2/*$(function() {
3window.console = { log: function(msg){}, warn: function(msg){}, debug: function(msg){}, info: function(msg){}, warn: function(msg){}, error: function(msg){}, dir: function(msg){}, dirxml: function(msg){}, count: function(msg){}, assert: function(msg){}, trace: function(msg){}  };
4});*/
5
6(function($) {
7    // tmplをDOM出力したかどうかのフラグ
8    var is_output_tmpl_gmenu_cont = false;
9    //テンプレートノード
10    var tmpl_gmenu_cont;
11
12    var $gmenu_underline;
13
14    // サイト内検索 送信元ページ文字コード差異吸収
15    // ready() に先立って実行
16    fixCharsetForSiteSearch();
17	
18	setSeoParam();
19	setCanonical();
20	
21    $(function() {
22
23        /*----------------------*/
24        // マウスのオーバレイ、先頭へもどる
25        // などのアクションを初期化
26        /*-----------------------*/
27        initMouseAction();
28
29
30        /*----------------------*/
31        // 上下センター処理、かどまる処理など
32        /*-----------------------*/
33        setLayout($("body"));
34
35        /*----------------------*/
36        // 文字数制限
37        /*-----------------------*/
38        $('#contents').find('.txt_itemreview > p').truncateText();
39
40        /*----------------------*/
41        // メニューのカレント(静的ファイルでの確認用)
42        /*-----------------------*/
43        //listkeyword();//多重実行
44        setGmenuCurrent();
45
46        /*----------------------*/
47        // カート投入数更新
48        /*-----------------------*/
49        $('#alert_cartnum').text($.cookie('CART_COUNT') ? $.cookie('CART_COUNT') : 0);
50        fixBorderRadius($('#alert_cartnum').parent());
51
52        /*----------------------*/
53        // 右クリック禁止
54        /*-----------------------*/
55        if(! $('#item_detail').length) {
56            $('#contents').add('#bottomarea_body').find('img').handleFigure();
57        }
58
59    });
60
61    /*----------------------*/
62    //
63    // setGmenuCurrent
64    // ページ毎にメニューのカレントクラスを付与する
65    // 静的ファイルでの確認用、組み込み時にはCMS側でクラスを付与するのでこの処理は不要と思われる
66    //
67    /*-----------------------*/
68    function setGmenuCurrent() {
69
70        var url = location.href;
71        var currentClassName = 'gmenu_current';
72
73        if (url.indexOf('ladies') !== -1) {
74            $('.gmenu_ladies').addClass(currentClassName);
75        } else if (url.indexOf('mens') !== -1) {
76            $('.gmenu_mens').addClass(currentClassName);
77        } else if (url.indexOf('sports') !== -1) {
78            $('.gmenu_sports').addClass(currentClassName);
79        } else if (url.indexOf('shops') !== -1) {
80            $('.gmenu_search').addClass(currentClassName);
81        }
82
83    }
84
85
86    /*----------------------*/
87    //
88    // setLayout
89    //
90    /*-----------------------*/
91    function setLayout($target_wrapper) {
92      if(!$target_wrapper.hasClass("is_already_set_layout")){
93
94        //実行済みクラスを付与
95        $target_wrapper.addClass("is_already_set_layout");
96
97        /* -----------------------*/
98        // センターにする処理
99        /* -----------------------*/
100        $target_wrapper.find(".vmiddle").each(function() {
101            var $self = $(this);
102            $self.css({
103                marginTop: -$self.height() / 2
104            });
105        });
106
107        $target_wrapper.find(".hmiddle").each(function() {
108            var $self = $(this);
109            $self.css({
110                marginLeft: -$self.width() / 2
111            });
112        });
113
114        /*----------------------*/
115        // レガシーブラウザへのborder-radius適用
116        /*-----------------------*/
117        fixBorderRadius($target_wrapper);
118      }
119    }
120
121
122    /*----------------------*/
123    //
124    // initMouseAction
125    //
126    /*-----------------------*/
127    function initMouseAction() {
128
129        /*----------------------*/
130        // ハーフカバーのマウスオーバ
131        /*-----------------------*/
132        // $(".halfcover").each(function() {
133        //     var $self = $(this);
134        //     var $cover = $self.find("p");
135        //     $self.hover(function() {
136
137        //         U.animate($cover, {
138        //             left: "45%",
139
140        //         }, 100, "easeOutQuad");
141        //         return false;
142        //     }, function() {
143
144        //         U.animate($cover, {
145        //             left: "50%",
146        //         }, 100, "easeOutQuad");
147        //         return false;
148        //     });
149        // });
150
151        /*----------------------*/
152        // ページの先頭へ
153        /*-----------------------*/
154        $(".backtotop").on("click", "a", function() {
155
156
157            $('html, body').animate({
158                scrollTop: 0
159            }, {
160                duration: 1400,
161                easing: "easeOutExpo"
162            });
163            return false;
164        });
165    }
166
167    /*----------------------*/
168    //
169    // fixBorderRadius
170    //
171    /*-----------------------*/
172    function fixBorderRadius($target_wrapper) {
173
174        var $target = $target_wrapper.find("[class*='border_radius_']");
175
176        $target.each(function() {
177
178            var radiusClass = $(this).attr('class').match(/border_radius_[^\s]*/)[0];
179            var radius = radiusClass.replace('border_radius_', '').split('_');
180
181            var borderColor = '';
182            var color = '';
183
184            // 角に親要素の背景色がついてしまう場合のfix
185            // html上でborder_color_#xxxxとして指定する
186            if ($(this).attr('class').indexOf('border_color_') !== -1) {
187                borderColor = ($(this).attr('class').match(/border_color_[^\s]*/)[0]);
188                color = ' cc:' + borderColor.replace('border_color_', '');
189            }
190
191            if (radius.length === 1) {
192
193                // 4つの角が全て同じRの場合
194                $(this).corner(radius + 'px' + color);
195
196            } else {
197
198                // 4つの角がそれぞれにRを指定していた場合
199                // jquery.cornerは0px指定が出来ないようなので0の場合は適用しない
200                if (radius[0] !== '0') $(this).corner('tl' + radius[0] + 'px' + color);
201                if (radius[1] !== '0') $(this).corner('tr' + radius[1] + 'px' + color);
202                if (radius[2] !== '0') $(this).corner('br' + radius[2] + 'px' + color);
203                if (radius[3] !== '0') $(this).corner('bl' + radius[3] + 'px' + color);
204
205            }
206        });
207    }
208
209    /*----------------------*/
210    // 画像Notfound対応
211    /*-----------------------*/
212    $.fn.replaceUnfoundImg = function(options) {
213        var settings = {
214            srcImgSubstitute: '/common_wacoal_jp/img/spacer.gif'
215        }
216        $.extend(settings, options);
217
218        var $listElemTarg = this;
219
220        $listElemTarg.each(function() {
221            var domElemTarg = $(this).get(0);
222            var srcImg = domElemTarg.getAttribute('src');
223
224            domElemTarg.onerror = function() {
225                //代替画像(デフォルトspacer.gif)を表示
226                domElemTarg.setAttribute('src', settings.srcImgSubstitute);
227            };
228            domElemTarg.src = srcImg;
229        });
230    };
231
232    $.fn.removeUnfoundImg = function(options) {
233        var settings = {
234        }
235        $.extend(settings, options);
236
237        var $listElemTarg = this;
238
239        $listElemTarg.each(function() {
240            var $elemTarg = $(this);
241            var domElemTarg = $elemTarg.get(0);
242
243            domElemTarg.onerror = function() {
244                $elemTarg.remove();
245            };
246
247            domElemTarg.src=domElemTarg.src;
248        });
249
250        return this;
251    };
252
253    /*----------------------*/
254    // サイト内検索 送信元ページ文字コード差異吸収
255    /*-----------------------*/
256	function fixCharsetForSiteSearch() {
257		var isMSIE = /*@cc_on!@*/false;
258		if(! isMSIE) {
259			return;
260		}
261
262		var $elemMetaCharset = $('meta[http-equiv="content-type"], meta[charset]').first();
263		var charsetOrg = $elemMetaCharset.attr('charset').toUpperCase();
264
265		var charsetCurrent = document.charset.toUpperCase();
266
267		if(charsetCurrent != charsetOrg) {
268			document.charset = charsetOrg;
269			location.reload();
270		}
271	}
272	
273	function setSeoParam() {
274		var $title = $("title").text();
275		var $description = $("meta[name=description]").attr("content");
276		$(document).ready(function(){
277			if($("[id^=shops_]").length > 0){ //店舗検索一覧への、ページ番号付与
278				var page_num = $(".c-pagination_item-current a").eq(0).text();
279				if(page_num){
280				var $extend = " "+page_num+"ページ目 ";
281					$("title").text($title.replace("検索結果","検索結果"+$extend));
282					$("meta[name=description]").attr("content", $description.replace("検索結果","検索結果"+$extend));
283				}
284			}
285			else if($("body.search_result.brand").length > 0){ //ブランド店舗検索
286				var page_num = $(".c-pagination_item-current a").eq(0).text();
287				if(page_num){
288				var $extend = " "+page_num+"ページ目 ";
289					$("title").text($title.replace("店舗を探す","店舗を探す"+$extend));
290					$("meta[name=description]").attr("content", $description+$extend);
291				}
292			}
293			else if($("#item_search-result").length > 0) { // 商品一覧、ページ番号、表示順付与
294				_setMeta($title, $description, ".page_navigation_list .current", ".view_change_content_inner .current");
295			}
296			else if($("#item_search-result-display").length > 0){ // 商品検索、ページ番号、表示順付与
297				_setMeta($title, $description, ".page_navigation_list .current", ".view_change_content_inner .current")
298			}
299		});
300
301		function _setMeta($title, $description, $page_num_selector, $sort_selector){
302			var page_num = $($page_num_selector).eq(0).text();
303			var extend = "";
304			if(page_num){
305			  extend = extend+" "+page_num+"ページ目";
306			}
307			$("title").text($title.replace("商品一覧","商品一覧"+extend));
308			var description = "";
309			if($description.match(/商品検索/)){
310				description = $description.replace("商品検索","商品検索"+extend);
311			}else if($description.match(/商品一覧/)){
312				description = $description.replace("商品一覧","商品一覧"+extend);
313			}
314			$("meta[name=description]").attr("content", description);
315		}
316	}
317	
318	function setCanonical() {
319		$(document).ready(function(){
320			var linkElement = document.createElement('link');
321			linkElement.setAttribute('rel', 'canonical');
322
323			if($("[id^=shops_]").length > 0){ //店舗検索一覧への、ページ番号付与
324				_setHref(linkElement);
325			}
326			else if($("body.search_result.brand").length > 0){ //ブランド店舗検索
327				_setHref(linkElement);
328			}
329			else if($("#item_search-result").length > 0){ // 商品一覧、ページ番号
330				_setHref(linkElement);
331			}
332			else if($("#item_search-result-display").length > 0){ // 商品検索、ページ番号
333				_setHref(linkElement);
334			}
335		});
336		function _setHref(linkElement){
337			if($('link[rel=canonical]').length == 0){
338				var queryArray = location.search.replace("?", "").split("&");
339				var hrefQuery = "";
340				$.each(queryArray, function(i, query) {
341					if(query.match(/dispNo/)){
342						hrefQuery = query;
343					}
344					else if(query.match(/bbr/)){
345						hrefQuery = query;
346					}
347                });
348				var href = location.href.replace(location.search, "");
349				if(!hrefQuery){
350					hrefQuery = queryArray[0];
351				}
352				href = href+"?"+hrefQuery;
353				linkElement.setAttribute('href', href);
354				$('head').prepend(linkElement);
355			}
356		}
357	}
358})(jQuery);
359

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.