[16708] | 1 | <?php |
---|
| 2 | require_once '../../../../require.php'; |
---|
| 3 | ob_start(); |
---|
| 4 | ?> |
---|
| 5 | /* |
---|
| 6 | * Thickbox 3.1 - One Box To Rule Them All. |
---|
| 7 | * By Cody Lindley (http://www.codylindley.com) |
---|
| 8 | * Copyright (c) 2007 cody lindley |
---|
| 9 | * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | /* |
---|
| 13 | * ownersstore.js |
---|
| 14 | * |
---|
| 15 | * オーナーズストア通信用ライブラリ. |
---|
| 16 | * CSSやjavascriptのオーバーレイ処理はThickboxのものを使っています. |
---|
| 17 | * |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | (function() { |
---|
| 21 | // オーナーズストア通信スクリプトのパス |
---|
| 22 | var upgrade_url = '[%URL_DIR%]upgrade/index.php'; |
---|
| 23 | |
---|
| 24 | // ロード中メッセージ(配信サーバと通信中です…) |
---|
| 25 | var loading_message = '\u30B5\u30FC\u30D0\u3068\u901A\u4FE1\u4E2D\u3067\u3059'; |
---|
| 26 | |
---|
| 27 | // ロード中画像の先読み |
---|
| 28 | var loading_img = new Image(); |
---|
[16729] | 29 | loading_img.src = '[%URL_DIR%]user_data/packages/default/img/ajax/loading.gif'; |
---|
[16708] | 30 | |
---|
| 31 | var OwnersStore = function() {} |
---|
| 32 | OwnersStore.prototype = { |
---|
| 33 | // detect Mac and Firefox use. |
---|
| 34 | detectMacFF: function() { |
---|
| 35 | var ua = navigator.userAgent.toLowerCase(); |
---|
| 36 | if (ua.indexOf('mac') != -1 && ua.indexOf('firefox') != -1) { |
---|
| 37 | return true; |
---|
| 38 | } |
---|
| 39 | }, |
---|
| 40 | // remove ajax window |
---|
| 41 | remove: function() { |
---|
| 42 | $("#TB_window").fadeOut( |
---|
| 43 | "fast", |
---|
| 44 | function(){ |
---|
| 45 | $('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove(); |
---|
| 46 | } |
---|
| 47 | ); |
---|
| 48 | $("#TB_load").remove(); |
---|
| 49 | //if IE 6 |
---|
| 50 | if (typeof document.body.style.maxHeight == "undefined") { |
---|
| 51 | $("body", "html").css({height: "auto", width: "auto"}); |
---|
| 52 | $("html").css("overflow", ""); |
---|
| 53 | } |
---|
| 54 | return false; |
---|
| 55 | }, |
---|
| 56 | // show loading page |
---|
| 57 | show_loading: function() { |
---|
| 58 | //if IE 6 |
---|
| 59 | if (typeof document.body.style.maxHeight === "undefined") { |
---|
| 60 | $("body","html").css({height: "100%", width: "100%"}); |
---|
| 61 | $("html").css("overflow","hidden"); |
---|
| 62 | //iframe to hide select elements in ie6 |
---|
| 63 | if (document.getElementById("TB_HideSelect") === null) { |
---|
| 64 | $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); |
---|
| 65 | $("#TB_overlay").click(this.remove); |
---|
| 66 | } |
---|
| 67 | //all others |
---|
| 68 | } else { |
---|
| 69 | if(document.getElementById("TB_overlay") === null){ |
---|
| 70 | $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); |
---|
| 71 | $("#TB_overlay").click(this.remove); |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | if(this.detectMacFF()){ |
---|
| 76 | //use png overlay so hide flash |
---|
| 77 | $("#TB_overlay").addClass("TB_overlayMacFFBGHack"); |
---|
| 78 | } else { |
---|
| 79 | //use background and opacity |
---|
| 80 | $("#TB_overlay").addClass("TB_overlayBG"); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | //add and show loader to the page |
---|
| 84 | $("body").append( |
---|
| 85 | "<div id='TB_load'>" |
---|
| 86 | + " <p style='color:#ffffff'>" + loading_message + "</p>" |
---|
| 87 | + " <img src='" + loading_img.src + "' />" |
---|
| 88 | + "</div>" |
---|
| 89 | ); |
---|
| 90 | $('#TB_load').show(); |
---|
| 91 | }, |
---|
[16878] | 92 | |
---|
[16708] | 93 | // show results |
---|
[16878] | 94 | show_result: function(resp, status, product_id) { |
---|
| 95 | var title = resp.status || 'ERROR'; |
---|
| 96 | var contents = resp.msg || ''; |
---|
[16708] | 97 | |
---|
| 98 | var TB_WIDTH = 400; |
---|
| 99 | var TB_HEIGHT = 300; |
---|
| 100 | var ajaxContentW = TB_WIDTH - 20; |
---|
| 101 | var ajaxContentH = TB_HEIGHT - 45; |
---|
| 102 | |
---|
| 103 | if ($("#TB_window").css("display") != "block"){ |
---|
| 104 | $("#TB_window").append( |
---|
| 105 | "<div id='TB_title'>" |
---|
| 106 | + " <div id='TB_ajaxWindowTitle'></div>" |
---|
| 107 | + " <div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' onclick='OwnersStore.remove();'>close</a></div>" |
---|
| 108 | + "</div>" |
---|
| 109 | + "<div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'>" |
---|
| 110 | + "</div>" |
---|
| 111 | ); |
---|
| 112 | //this means the window is already up, we are just loading new content via ajax |
---|
| 113 | } else { |
---|
| 114 | $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; |
---|
| 115 | $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; |
---|
| 116 | $("#TB_ajaxContent")[0].scrollTop = 0; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | $("#TB_load").remove(); |
---|
| 120 | $("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); |
---|
| 121 | |
---|
| 122 | // take away IE6 |
---|
| 123 | if (!(jQuery.browser.msie && jQuery.browser.version < 7)) { |
---|
| 124 | $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | $("#TB_ajaxWindowTitle").html(title); |
---|
| 128 | $("#TB_ajaxContent").html(contents); |
---|
| 129 | $("#TB_window").css({display:"block"}); |
---|
[16878] | 130 | |
---|
| 131 | // DL成功時に設定ボタンを表示 |
---|
| 132 | if (resp.status == 'SUCCESS' && product_id) { |
---|
[16900] | 133 | $('#ownersstore_settings_default' + product_id).hide(); // --を非表示 |
---|
| 134 | $('#ownersstore_settings' + product_id).show(); // 設定ボタン表示 |
---|
| 135 | $('#ownersstore_download' + product_id).html('\u6E08\u307F'); // インストール/アップロードボタンを--へ変換 |
---|
[16932] | 136 | $('#ownersstore_version' + product_id).html(resp.data.version); |
---|
[16878] | 137 | } |
---|
[16708] | 138 | }, |
---|
| 139 | |
---|
| 140 | // exexute install or update |
---|
| 141 | download: function(product_id) { |
---|
| 142 | this.show_loading(); |
---|
[16878] | 143 | var show = this.show_result; |
---|
[16708] | 144 | $.post( |
---|
| 145 | upgrade_url, |
---|
| 146 | {mode: 'download', product_id: product_id}, |
---|
[16878] | 147 | function(resp, status) { |
---|
| 148 | show(resp, status, product_id); |
---|
| 149 | }, |
---|
[16708] | 150 | 'json' |
---|
| 151 | ) |
---|
| 152 | }, |
---|
[16878] | 153 | |
---|
[16708] | 154 | // get products list |
---|
| 155 | products_list: function() { |
---|
| 156 | this.show_loading(); |
---|
| 157 | var show = this.show_result; |
---|
| 158 | var remove = this.remove; |
---|
| 159 | $().ajaxError(this.show_result); |
---|
| 160 | $.post( |
---|
[16878] | 161 | upgrade_url, |
---|
[16708] | 162 | {mode: 'products_list'}, |
---|
| 163 | function(resp, status) { |
---|
[16842] | 164 | if (resp.status == 'SUCCESS') { |
---|
| 165 | remove(); |
---|
| 166 | $('#ownersstore_products_list').html(resp.msg); |
---|
| 167 | } else { |
---|
[16708] | 168 | show(resp, status); |
---|
| 169 | } |
---|
| 170 | }, |
---|
| 171 | 'json' |
---|
| 172 | ) |
---|
| 173 | } |
---|
| 174 | } |
---|
| 175 | window.OwnersStore = new OwnersStore(); |
---|
| 176 | })(); |
---|
| 177 | <?php |
---|
| 178 | header('Content-Type: application/x-javascript'); |
---|
| 179 | echo str_replace('[%URL_DIR%]', URL_DIR, ob_get_clean()); |
---|
| 180 | ?> |
---|