1"use strict"; 2 3window.document.observe('dom:loaded', function(){ 4 setupButtons(); 5 setupGuidance(); 6 setupGlobalMenu(); 7 setupPageLayoutUtility(); 8 setupTopPageListBoxHeight(); 9 setupPageScroll(); 10}); 11 12var swapImage = function (img, flg) { 13 img.src = img.src.replace(/^(.*)(on|off)(\.\w+)$/, "$1" + flg + "$3"); 14} 15var isSmartPhone = function () { 16 var agent = navigator.userAgent; 17 return (agent.search(/(iPhone|Android|IEMobile)/) != -1); 18} 19 20/* 21 * setupGuidance 22 * ã¹ããç¨ã®ã¬ã¤ãã³ã¹ã表示 23 */ 24var setupGuidance = function() { 25 if(!$("guidance_sp")) return; 26 27 if(!isSmartPhone()) return; 28 29 // ãã§ãã¯ONã®ã¤ã¡ã¼ã¸ãå èªã¿ 30 var img = new Image(); 31 img.src = '/common/image/g_check_on.png'; 32 33 $("guidance_sp").show(); 34 35 var checkImg = $("check_no_message").down("img"); 36 var checked = false; 37 $("check_no_message").observe("click", function() { 38 checked = !checked; 39 if( checked) swapImage(checkImg, 'on'); 40 if(!checked) swapImage(checkImg, 'off'); 41 }); 42 $("show_sp_site").observe("click", function() { 43 var value = checked ? "sp" : ""; 44 Cookie.set("viewmode", value, 24 * 30); 45 }); 46} 47 48/* 49 * setupPageScroll 50 * ãã¼ã¸å ã¸ã£ã³ããã¹ã¯ãã¼ã«ã«å¤æ´ 51 */ 52var setupPageScroll = function() { 53 $$('a[href^=#]:not([href=#])').each(function(element) { 54 element.observe('click', function(event) { 55 new Effect.ScrollTo(this.hash.substr(1), { duration: 0.5 }); 56 Event.stop(event); 57 return false; 58 }.bindAsEventListener(element)) 59 }); 60}; 61 62/* 63 * setupButtons 64 * a > img ãã¿ã³ã®ç»ååãæ¿ã 65 */ 66var setupButtons = function() { 67 $$('a.button').each(function(anchor){ 68 var img = anchor.down('img'); 69 anchor 70 .observe('mouseover', function(){ 71 if(anchor.hasClassName('nochange')) return; 72 img.src = img.src.replace(/_off\./,'_on.'); 73 }) 74 .observe('mouseout', function(){ 75 if(anchor.hasClassName('nochange')) return; 76 img.src = img.src.replace(/_on\./,'_off.'); 77 }) 78 ; 79 }); 80}; 81 82/* 83 * setupGlobalMenu 84 * ãããããã¦ã³ã¡ãã¥ã¼ãæå¹å 85 */ 86var setupGlobalMenu = function() { 87 $$("nav ul").each(function(ul){ 88 ul.addClassName("dropdown_menu"); 89 }); 90}; 91 92/* 93 * setupPageLayoutUtility 94 * å°å·ã¬ã¤ã¢ã¦ãã¨é常ã¬ã¤ã¢ã¦ãã®åãæ¿ã 95 */ 96var setupPageLayoutUtility = function() { 97 var $pageLayoutUtility = $("page_layout_utility"); 98 if(!$pageLayoutUtility) return; 99 $pageLayoutUtility.show(); 100 var $body = $(window.document.body); 101 var helper = { 102 changeLayoutPrint: function() { 103 $body.addClassName("page_layout_for_print"); 104 Cookie.set("keep_layout_print", "1"); 105 }, 106 changeLayoutNormal: function() { 107 $body.removeClassName("page_layout_for_print"); 108 Cookie.set("keep_layout_print", "0"); 109 }, 110 print: function() { 111 window.print(); 112 } 113 }; 114 var keep_layout_print = Cookie.get("keep_layout_print") || "0"; 115 if(keep_layout_print == "1") helper.changeLayoutPrint(); 116 $pageLayoutUtility.down("a.icon_print_layout").observe("click", helper.changeLayoutPrint); 117 $pageLayoutUtility.down("a.icon_normal_layout").observe("click", helper.changeLayoutNormal); 118 $pageLayoutUtility.down("a.icon_print").observe("click", helper.print); 119}; 120 121/* 122 * 123 */ 124var setupTopPageListBoxHeight = function() { 125 var arrangeListBoxHeight = function($a, $b, adjust) { 126 if(!$a || !$b) return; 127 $a.setStyle({ 'height': null }); 128 $b.setStyle({ 'height': null }); 129 130 var height = Math.max($a.getHeight(), $b.getHeight()); 131 $a.setStyle({ 'height': (height - adjust) + "px" }); 132 $b.setStyle({ 'height': (height - adjust) + "px" }); 133 }; 134 var arrangeListBoxHeightAll = function() { 135 var left_list = $$(".contents_list_box_left"); 136 var right_list = $$(".contents_list_box_right"); 137 left_list.each(function($element, index) { 138 arrangeListBoxHeight($element.down(".list"), right_list[index].down(".list"), 3); 139 }); 140 left_list = $$(".contents_list_box_left > .container > h3 + p"); 141 right_list = $$(".contents_list_box_right > .container > h3 + p"); 142 left_list.each(function($element, index) {
143 arrangeListBoxHeight($element, right_list[index], 0); 144 }); 145 }; 146 arrangeListBoxHeightAll(); 147 Event.observe(window, "resize", arrangeListBoxHeightAll); 148};
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.