EC-CUBE /
ec-cube
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | /*! |
||
| 2 | * function.js for EC-CUBE admin |
||
| 3 | */ |
||
| 4 | |||
| 5 | jQuery(document).ready(function ($) { |
||
| 6 | |||
| 7 | /* |
||
| 8 | * Brake point Check |
||
| 9 | */ |
||
| 10 | |||
| 11 | |||
| 12 | $(window).on('load , resize', function () { |
||
| 13 | $('body').removeClass('pc_view md_view sp_view'); |
||
| 14 | if (window.innerWidth < 768) { |
||
| 15 | $('body').addClass('sp_view'); |
||
| 16 | $('#wrapper').removeClass('sidebar-open'); // for Drawer menu |
||
| 17 | } else if (window.innerWidth < 992) { |
||
| 18 | $('body').addClass('md_view'); |
||
| 19 | $('#wrapper').addClass('sidebar-open'); // for Drawer menu |
||
| 20 | } else { |
||
| 21 | $('body').addClass('pc_view'); |
||
| 22 | $('#wrapper').addClass('sidebar-open'); // for Drawer menu |
||
| 23 | } |
||
| 24 | return false; |
||
| 25 | }); |
||
| 26 | |||
| 27 | |||
| 28 | /* |
||
| 29 | * Drawer menu |
||
| 30 | */ |
||
| 31 | |||
| 32 | $('.bt_drawermenu').on('click', function () { |
||
| 33 | if ($('.sidebar-open #side').size() == 0) { |
||
|
0 ignored issues
–
show
|
|||
| 34 | $('#wrapper').addClass('sidebar-open'); |
||
| 35 | } else { |
||
| 36 | $('#wrapper').removeClass('sidebar-open'); |
||
| 37 | } |
||
| 38 | return false; |
||
| 39 | }); |
||
| 40 | |||
| 41 | |||
| 42 | /////////// SideBar accordion |
||
| 43 | |||
| 44 | $("#side li .toggle").click(function () { |
||
| 45 | if ($("+ul", this).css("display") == "none") { |
||
| 46 | $(this).parent('li').addClass("active"); |
||
| 47 | $("+ul", this).slideDown(300); |
||
| 48 | } else { |
||
| 49 | $(this).parent('li').removeClass("active"); |
||
| 50 | $("+ul", this).slideUp(300); |
||
| 51 | } |
||
| 52 | return false; |
||
| 53 | }); |
||
| 54 | |||
| 55 | /////////// accordion |
||
| 56 | |||
| 57 | $(".accordion .toggle").click(function () { |
||
| 58 | if ($("+.accpanel", this).css("display") == "none") { |
||
| 59 | $(this).addClass("active"); |
||
| 60 | $("+.accpanel", this).slideDown(300); |
||
| 61 | } else { |
||
| 62 | $(this).removeClass("active"); |
||
| 63 | $("+.accpanel", this).slideUp(300); |
||
| 64 | } |
||
| 65 | return false; |
||
| 66 | }); |
||
| 67 | |||
| 68 | |||
| 69 | /////////// dropdownの中をクリックしても閉じないようにする |
||
| 70 | |||
| 71 | $(".dropdown-menu").click(function (e) { |
||
| 72 | e.stopPropagation(); |
||
| 73 | }); |
||
| 74 | |||
| 75 | |||
| 76 | /////////// 追従サイドバー |
||
| 77 | |||
| 78 | // スクロールした時に以下の処理 |
||
| 79 | $(window).on("scroll", function () { |
||
| 80 | //PC表示の時のみに適用 |
||
| 81 | if (window.innerWidth > 993) { |
||
| 82 | |||
| 83 | if ($('#aside_wrap').length) { |
||
| 84 | |||
| 85 | var side = $("#aside_column"), |
||
| 86 | wrap = $("#aside_wrap"), |
||
| 87 | heightH = $("#header").outerHeight(), |
||
| 88 | min_move = wrap.offset().top, |
||
| 89 | max_move = wrap.offset().top + wrap.height() - side.height() - 2 * parseInt(side.css("top")), |
||
| 90 | margin_bottom = max_move - min_move; |
||
| 91 | |||
| 92 | var scrollTop = $(window).scrollTop(); |
||
| 93 | if (scrollTop > min_move && scrollTop < max_move) { |
||
| 94 | var margin_top = scrollTop - min_move; |
||
| 95 | side.css({"margin-top": margin_top + heightH + 10}); |
||
| 96 | } else if (scrollTop < min_move) { |
||
| 97 | side.css({"margin-top": 0}); |
||
| 98 | } else if (scrollTop > max_move) { |
||
| 99 | side.css({"margin-top": margin_bottom}); |
||
| 100 | } |
||
| 101 | } |
||
| 102 | |||
| 103 | } |
||
| 104 | |||
| 105 | return false; |
||
| 106 | }); |
||
| 107 | |||
| 108 | |||
| 109 | // var fixedcolumn = $('#aside_column'), |
||
| 110 | // offset = fixedcolumn.offset(); |
||
| 111 | // |
||
| 112 | // $(window).scroll(function () { |
||
| 113 | // if($(window).scrollTop() > offset.top - 80) { |
||
| 114 | // fixedcolumn.addClass('fixed'); |
||
| 115 | // } else { |
||
| 116 | // fixedcolumn.removeClass('fixed'); |
||
| 117 | // } |
||
| 118 | // }); |
||
| 119 | |||
| 120 | // マスク処理 |
||
| 121 | $('.prevention-mask').on('click', function() { |
||
| 122 | $overlay = $('<div class="prevention-masked">'); |
||
| 123 | $('body').append($overlay); |
||
| 124 | }); |
||
| 125 | |||
| 126 | // ダブルクリック禁止 |
||
| 127 | $('.prevention-btn').on('click', function() { |
||
| 128 | $(this).attr('disabled', 'disabled'); |
||
| 129 | var $form = $(this).parents('form'); |
||
| 130 | // マスク表示させるためsetTimeoutを使って処理を遅らせる |
||
| 131 | setTimeout(function(){ |
||
| 132 | $form.submit(); |
||
| 133 | }, 0); |
||
| 134 | return false; |
||
| 135 | }); |
||
| 136 | |||
| 137 | /////////// 検索条件をクリア |
||
| 138 | $('.search-clear').click(function (event) { |
||
| 139 | event.preventDefault(event); |
||
| 140 | $('.search-box-inner input, .search-box-inner select').each(function () { |
||
| 141 | if (this.type == "checkbox" || this.type == "radio") { |
||
| 142 | this.checked = false; |
||
| 143 | } else { |
||
| 144 | if (this.type == "hidden") { |
||
| 145 | if (!this.name.match(/_token/i)) { |
||
| 146 | $(this).val(""); |
||
| 147 | } |
||
| 148 | } else { |
||
| 149 | $(this).val(""); |
||
| 150 | } |
||
| 151 | } |
||
| 152 | }); |
||
| 153 | }); |
||
| 154 | |||
| 155 | /////////// アコーディオントグル制御( フォームに値があれば、アコーディオン中止 ) |
||
| 156 | //フォーム値確認用関数 |
||
| 157 | formPropStateSubscriber = function() { |
||
| 158 | ad_flg = false; //アコーディオン初期値 |
||
| 159 | return { |
||
| 160 | formState : function() { |
||
| 161 | this.chcekForm(); |
||
| 162 | return this.getFormState(); |
||
| 163 | }, |
||
| 164 | chcekForm : function(){ |
||
| 165 | $('.search-box-inner input, .search-box-inner select').each(function () { |
||
| 166 | if (this.type == "checkbox" || this.type == "radio") { |
||
| 167 | if (this.checked) { |
||
| 168 | ad_flg = true; |
||
| 169 | return true; |
||
| 170 | } |
||
| 171 | } else { |
||
| 172 | if (this.type != "hidden") { |
||
| 173 | if ($(this).val()) { |
||
| 174 | ad_flg = true; |
||
| 175 | return true; |
||
| 176 | } |
||
| 177 | } |
||
| 178 | } |
||
| 179 | }); |
||
| 180 | }, |
||
| 181 | getFormState : function() { |
||
| 182 | return ad_flg; |
||
| 183 | } |
||
| 184 | }; |
||
| 185 | }; |
||
| 186 | }); |
||
| 187 | |||
| 188 | // anchorをクリックした時にformを裏で作って指定のメソッドでリクエストを飛ばす |
||
| 189 | // Twigには以下のように埋め込む |
||
| 190 | // <a href="PATH" {{ csrf_token_for_anchor() }} data-method="(put/delete/postのうちいずれか)" data-confirm="xxxx" data-message="xxxx"> |
||
| 191 | // |
||
| 192 | // オプション要素 |
||
| 193 | // data-confirm : falseを定義すると確認ダイアログを出さない。デフォルトはダイアログを出す |
||
| 194 | // data-message : 確認ダイアログを出す際のメッセージをデフォルトから変更する |
||
| 195 | // |
||
| 196 | $(function () { |
||
| 197 | var createForm = function (action, data) { |
||
| 198 | var $form = $('<form action="' + action + '" method="post"></form>'); |
||
| 199 | for (input in data) { |
||
|
0 ignored issues
–
show
|
|||
| 200 | if (data.hasOwnProperty(input)) { |
||
| 201 | $form.append('<input name="' + input + '" value="' + data[input] + '">'); |
||
| 202 | } |
||
| 203 | } |
||
| 204 | return $form; |
||
| 205 | }; |
||
| 206 | |||
| 207 | $('a[token-for-anchor]').click(function (e) { |
||
| 208 | e.preventDefault(); |
||
| 209 | var $this = $(this); |
||
| 210 | var data = $this.data(); |
||
| 211 | if (data.confirm != false) { |
||
|
0 ignored issues
–
show
It is recommended to use
!== to compare with false.
Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator. Loading history...
|
|||
| 212 | if (!confirm(data.message ? data.message : '削除してもよろしいですか?')) { |
||
| 213 | return false; |
||
| 214 | } |
||
| 215 | } |
||
| 216 | |||
| 217 | var $form = createForm($this.attr('href'), { |
||
| 218 | _token: $this.attr('token-for-anchor'), |
||
| 219 | _method: data.method |
||
| 220 | }).hide(); |
||
| 221 | |||
| 222 | $('body').append($form); // Firefox requires form to be on the page to allow submission |
||
| 223 | $form.submit(); |
||
| 224 | }); |
||
| 225 | }); |
||
| 226 |
Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.
Read more about comparison operations.