Last active
February 7, 2016 02:08
-
-
Save puyo-sh/89ab2bd9e077025b1b59 to your computer and use it in GitHub Desktop.
ブラウザ三国志 ぷちツール
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 3gokushi-puyo | |
// @namespace https://github.com/puyo-sh/bro3 | |
// @description ブラウザ三国志 ぷちツール | |
// @include http://*.3gokushi.jp/* | |
// @version 2.11 | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js | |
// @require http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js | |
// ==/UserScript== | |
// ご利用の際は自己責任にて \_(・ω・`)ココ重要! | |
// ver 0.1 なんとなく | |
// ver 0.2 即落チェッカーの追加 他微調整 | |
// ver 0.3 自動スキル機能追加 他微調整 | |
// ver 0.31 自動スキル起動時に問答無用で実行していたので確認追加。デッキコストが足りない状態の処理を追加 | |
// ver 1.0 待機中武将のデッキダウン機能及びデッキ画面での合成リンクを追加 | |
// 最初に想定していた最低限の機能が準備できたので一応正式版 | |
// ver 1.1 Gyazo表示対応 PagerLink拡張 | |
// ver 1.2 設定画面追加 武将ソートボタン 広告削除 | |
// ver 1.21 Gyazo機能によるバグ修正(書簡,BBSの入力画面に影響) | |
// ver 1.22 15.11.11 デッキセット拠点選択初期値機能公式が対応したのでコメントアウト | |
// ver 1.3 自動スキル(デッキセット系)追加 とりあえずいくつか適当に | |
// ver 1.4β 即落札機能追加(人柱版) | |
// ver 1.41β トレード用リンクURL生成(人柱版) | |
// ver 1.42β トレード用リンクURL生成 処理の見直し | |
// ver 1.43β 即落札機能バグ修正(TP不足時の例外処理追加)他 | |
// ver 1.5β 即時落札書簡削除機能(人柱版) | |
// ver 2.0 書簡コントロール系実装(全既読,落札削除,ログイン報酬削除) | |
// 第二想定機能が全て実装できたのでver2.0とする | |
// ver 2.1 要望により書簡全チェックボタン実装 | |
// ver 2.11 対応スキル追加(情報提供:H氏) | |
/* | |
1.各武将カードのID,名前,スキルからトレードへのリンクを追加 | |
2.各武将カードの殆ど使わない要素の表示/非表示を切り替え(初期:非表示) | |
停止:3.デッキセット時の拠点選択初期値を現在選択中の拠点に:設定無し | |
4.即落札の価格チェッカー | |
5.自動スキル(回復系) | |
6.デッキダウン機能 | |
7.合成リンク表示 | |
8.Gyazo表示 | |
9.Pager拡張 | |
10.武将ソートボタン | |
11.広告削除 | |
12.自動スキル(デッキセット系) | |
13.即落札ボタン | |
14.トレード用URL生成(TP不足の場合は生成できない(´・ω・`)) | |
15.即時落札書簡削除,ログイン報酬書簡削除,書簡全既読 | |
*/ | |
j$ = jQuery.noConflict(true); | |
(function ($){ | |
/* Chrome用GM_関数 | |
--------------------------------------------------------------------------------------------------------------*/ | |
// @copyright 2009, James Campos | |
// @license cc-by-3.0; http://creativecommons.org/licenses/by/3.0/ | |
if ((typeof GM_getValue == 'undefined') || (GM_getValue('a', 'b') == undefined)) { | |
GM_addStyle = function(css) { | |
var style = document.createElement('style'); | |
style.textContent = css; | |
document.getElementsByTagName('head')[0].appendChild(style); | |
} | |
GM_deleteValue = function(name) { | |
localStorage.removeItem(name); | |
} | |
GM_getValue = function(name, defaultValue) { | |
var value = localStorage.getItem(name); | |
if (!value) | |
return defaultValue; | |
var type = value[0]; | |
value = value.substring(1); | |
switch (type) { | |
case 'b': | |
return value == 'true'; | |
case 'n': | |
return Number(value); | |
default: | |
return value; | |
} | |
} | |
GM_log = function(message) { | |
if (window.opera) { | |
opera.postError(message); | |
return; | |
} | |
console.log(message); | |
} | |
GM_registerMenuCommand = function(name, funk) { | |
//todo | |
} | |
GM_setValue = function(name, value) { | |
value = (typeof value)[0] + value; | |
localStorage.setItem(name, value); | |
} | |
} | |
/* global | |
--------------------------------------------------------------------------------------------------------------*/ | |
lh = location.hostname; | |
lp = location.pathname; | |
// 設定画面関連 ================================================================================ | |
var LS_PREFIX = 'bro3_puyo_'; | |
var conf_param = {}; // 設定画面用 | |
// ID,名前,スキルからトレードへのリンクを追加 | |
var LS_TRADE_LINK = LS_PREFIX + 'trade_link' + lh; | |
var OPT_TRADE_LINK = (GM_getValue(LS_TRADE_LINK)) ? GM_getValue(LS_TRADE_LINK) : 0; | |
conf_param.NAME_TRADE_LINK = LS_TRADE_LINK; | |
conf_param.CHKD_TRADE_LINK = (OPT_TRADE_LINK) ? ' checked' : ''; | |
// デッキレイアウト調整(ラベル要素等非表示) | |
var LS_DECK_LAYOUT = LS_PREFIX + 'deck_layout' + lh; | |
var OPT_DECK_LAYOUT = (GM_getValue(LS_DECK_LAYOUT)) ? GM_getValue(LS_DECK_LAYOUT) : 0; | |
conf_param.NAME_DECK_LAYOUT = LS_DECK_LAYOUT; | |
conf_param.CHKD_DECK_LAYOUT = (OPT_DECK_LAYOUT) ? ' checked' : ''; | |
// 即落チェッカー | |
var LS_SBID = LS_PREFIX + 'sbid' + lh; | |
var OPT_SBID = (GM_getValue(LS_SBID)) ? GM_getValue(LS_SBID) : 0; | |
conf_param.NAME_SBID = LS_SBID; | |
conf_param.CHKD_SBID = (OPT_SBID) ? ' checked' : ''; | |
// 自動スキル(回復系) | |
var LS_AUTO_HEAL = LS_PREFIX + 'auto_heal' + lh; | |
var OPT_AUTO_HEAL = (GM_getValue(LS_AUTO_HEAL)) ? GM_getValue(LS_AUTO_HEAL) : 0; | |
conf_param.NAME_AUTO_HEAL = LS_AUTO_HEAL; | |
conf_param.CHKD_AUTO_HEAL = (OPT_AUTO_HEAL) ? ' checked' : ''; | |
// 自動スキル(デッキダウンしない) | |
var LS_AUTO_SKILL = LS_PREFIX + 'auto_skill' + lh; | |
var OPT_AUTO_SKILL = (GM_getValue(LS_AUTO_SKILL)) ? GM_getValue(LS_AUTO_SKILL) : 0; | |
conf_param.NAME_AUTO_SKILL = LS_AUTO_SKILL; | |
conf_param.CHKD_AUTO_SKILL = (OPT_AUTO_SKILL) ? ' checked' : ''; | |
// 一括デッキダウン | |
var LS_DECK_DOWN = LS_PREFIX + 'deck_down' + lh; | |
var OPT_DECK_DOWN = (GM_getValue(LS_DECK_DOWN)) ? GM_getValue(LS_DECK_DOWN) : 0; | |
conf_param.NAME_DECK_DOWN = LS_DECK_DOWN; | |
conf_param.CHKD_DECK_DOWN = (OPT_DECK_DOWN) ? ' checked' : ''; | |
// 合成リンク追加 | |
var LS_UNION_BOX = LS_PREFIX + 'union_box' + lh; | |
var OPT_UNION_BOX = (GM_getValue(LS_UNION_BOX)) ? GM_getValue(LS_UNION_BOX) : 0; | |
conf_param.NAME_UNION_BOX = LS_UNION_BOX; | |
conf_param.CHKD_UNION_BOX = (OPT_UNION_BOX) ? ' checked' : ''; | |
// GYAZO表示対応 | |
var LS_GYAZO = LS_PREFIX + 'gyazo' + lh; | |
var OPT_GYAZO = (GM_getValue(LS_GYAZO)) ? GM_getValue(LS_GYAZO) : 0; | |
conf_param.NAME_GYAZO = LS_GYAZO; | |
conf_param.CHKD_GYAZO = (OPT_GYAZO) ? ' checked' : ''; | |
// Pager拡張 | |
var LS_PAGER_EXTEND = LS_PREFIX + 'pager_extend' + lh; | |
var OPT_PAGER_EXTEND = (GM_getValue(LS_PAGER_EXTEND)) ? GM_getValue(LS_PAGER_EXTEND) : 0; | |
conf_param.NAME_PAGER_EXTEND = LS_PAGER_EXTEND; | |
conf_param.CHKD_PAGER_EXTEND = (OPT_PAGER_EXTEND) ? ' checked' : ''; | |
// 武将ソートボタン | |
var LS_BUSHO_SORT = LS_PREFIX + 'busho_sort' + lh; | |
var OPT_BUSHO_SORT = (GM_getValue(LS_BUSHO_SORT)) ? GM_getValue(LS_BUSHO_SORT) : 0; | |
conf_param.NAME_BUSHO_SORT = LS_BUSHO_SORT; | |
conf_param.CHKD_BUSHO_SORT = (OPT_BUSHO_SORT) ? ' checked' : ''; | |
// 広告削除 | |
var LS_AD_DEL = LS_PREFIX + 'ad_del' + lh; | |
var OPT_AD_DEL = (GM_getValue(LS_AD_DEL)) ? GM_getValue(LS_AD_DEL) : 0; | |
conf_param.NAME_AD_DEL = LS_AD_DEL; | |
conf_param.CHKD_AD_DEL = (OPT_AD_DEL) ? ' checked' : ''; | |
// 即落札ボタン | |
var LS_BID = LS_PREFIX + 'bid' + lh; | |
var OPT_BID = (GM_getValue(LS_BID)) ? GM_getValue(LS_BID) : 0; | |
conf_param.NAME_BID = LS_BID; | |
conf_param.CHKD_BID = (OPT_BID) ? ' checked' : ''; | |
// 即時落札書簡を削除 | |
var LS_BID_SHOKAN = LS_PREFIX + 'bid_shokan' + lh; | |
var OPT_BID_SHOKAN = (GM_getValue(LS_BID_SHOKAN)) ? GM_getValue(LS_BID_SHOKAN) : 0; | |
conf_param.NAME_BID_SHOKAN = LS_BID_SHOKAN; | |
conf_param.CHKD_BID_SHOKAN = (OPT_BID_SHOKAN) ? ' checked' : ''; | |
// 設定画面 | |
// if(lp.indexOf('/user/') != -1){ | |
var setting_html = (function(param){/* | |
<div id="bro3_puyo_conf_wrapper"> | |
<a href="javascript:void(0)">[ぷち設定]</a> | |
<ul id="bro3_puyo_conf"> | |
<li>設定:</li> | |
<li><div>自動スキル系</div></li> | |
<li><input type="checkbox" value="1" name="${NAME_AUTO_HEAL}" ${CHKD_AUTO_HEAL}> 自動スキル(回復系)</li> | |
<li><input type="checkbox" value="1" name="${NAME_AUTO_SKILL}" ${CHKD_AUTO_SKILL}> 自動スキル(デッキセット系)</li> | |
<li><div>トレード系</div></li> | |
<li><input type="checkbox" value="1" name="${NAME_TRADE_LINK}" ${CHKD_TRADE_LINK}> ID,名前,スキルからトレードへのリンクを追加</li> | |
<li><input type="checkbox" value="1" name="${NAME_SBID}" ${CHKD_SBID}> 即落チェッカー</li> | |
<li><input type="checkbox" value="1" name="${NAME_BID}" ${CHKD_BID}> 即落ボタン,トレード用リンクURL生成</li> | |
<li><div>便利系</div></li> | |
<li><input type="checkbox" value="1" name="${NAME_DECK_DOWN}" ${CHKD_DECK_DOWN}> 一括デッキダウン機能</li> | |
<li><input type="checkbox" value="1" name="${NAME_UNION_BOX}" ${CHKD_UNION_BOX}> 合成リンク追加</li> | |
<li><input type="checkbox" value="1" name="${NAME_BID_SHOKAN}" ${CHKD_BID_SHOKAN}> 書簡の全既読,一部削除機能</li> | |
<li><input type="checkbox" value="1" name="${NAME_GYAZO}" ${CHKD_GYAZO}> GYAZO対応</li> | |
<li><input type="checkbox" value="1" name="${NAME_PAGER_EXTEND}" ${CHKD_PAGER_EXTEND}> ページャーリンク拡張</li> | |
<li><input type="checkbox" value="1" name="${NAME_BUSHO_SORT}" ${CHKD_BUSHO_SORT}> 武将ソートボタン</li> | |
<li><input type="checkbox" value="1" name="${NAME_AD_DEL}" ${CHKD_AD_DEL}> 広告削除</li> | |
<li><input type="checkbox" value="1" name="${NAME_DECK_LAYOUT}" ${CHKD_DECK_LAYOUT}> ラベル表示の切替</li> | |
</ul> | |
</div> | |
<style> | |
<!-- | |
#bro3_puyo_conf_wrapper a{ | |
color:#333333; | |
} | |
#bro3_puyo_conf_wrapper{ | |
float: right; | |
width: 218px; | |
margin-top:5px; | |
font-size:10px; | |
position:relative; | |
} | |
#bro3_puyo_conf{ | |
display:none; | |
clear:both; | |
padding:3px; | |
right:60px; | |
z-index:99999; | |
position:absolute; | |
background-color:#FFFFFF; | |
border:1px solid #000000; | |
} | |
div#header div#navi01 #bro3_puyo_conf > li >div{ | |
background-color:#FFF8DC; | |
border:1px solid #E6E6FA; | |
} | |
div#header div#navi01 #bro3_puyo_conf li{ | |
float:none; | |
} | |
--> | |
</style> | |
*/}).toString().replace(/(\n)/g, '').split('*')[1]; | |
var setting_append_html = $.tmpl(setting_html,conf_param) || ''; | |
$("#navi01").append(setting_append_html); | |
$(document).on("change","#bro3_puyo_conf input[type=checkbox]",function(){ | |
var ls_name = $(this).attr("name"); | |
if($(this).is(":checked")){ | |
GM_setValue(ls_name,1); | |
}else{ | |
GM_deleteValue(ls_name); | |
} | |
}); | |
$(document).on("click","#bro3_puyo_conf_wrapper > a",function(){ | |
$("#bro3_puyo_conf").slideToggle(150); | |
}); | |
// } | |
// ================================================================================ | |
if(OPT_AD_DEL){ | |
// 広告削除 | |
$("div#info,div#mapbox + div").css({ | |
'cssText': 'display:none !important;' | |
}); | |
} | |
// 自動スキル対象 | |
auto_skills = { | |
"仁君" :"sd000", | |
"弓腰姫の愛" :"sd001", | |
"神医の術式" :"sd003", | |
"傾国" :"sd004", | |
"城壁補強" :"sd005", | |
"優雅な調べ" :"sd011", | |
"皇后の慈愛" :"sd012", | |
"神医の施術" :"sd013", | |
"桃色吐息" :"sd017", | |
"勇姫督励" :"sd018", | |
"劉備の契り" :"sd022", | |
"酔吟吐息" :"sd026", | |
"才女の瞳" :"sa027", | |
"文姫の慈愛" :"sd032", | |
"聖夜の天恵沢" :"rp020", | |
}; | |
auto_skill_names = []; | |
for(key in auto_skills){ | |
auto_skill_names.push(key); | |
} | |
// 自動スキル対象(デッキダウンしない) | |
auto_skills_2 = { | |
"王者の護り" :"df008", | |
"強兵の檄文" :"df015", | |
"攻城の檄文" :"df016", | |
"練兵修練" :"df029", | |
"兵舎修練" :"df030", | |
"弓兵修練" :"df031", | |
"厩舎修練" :"df032", | |
"兵器修練" :"df033", | |
"八卦の陣" :"df034", | |
"守護神" :"df035", | |
"地の利堅壁" :"df044", | |
"護君" :"df050", | |
"賢女の策略" :"df052", | |
"領地統制" :"df056", | |
"金剛不壊" :"df071", | |
"万華招来" :"df077", | |
"千華招来" :"df082", | |
"食糧技術" :"rp009", | |
"暴姫の命" :"sa021", | |
"槍将の采配" :"sd008", | |
"緊急帰還" :"sd019", | |
"呉の治世" :"sr000", | |
"王佐の才" :"sr001", | |
"虐帝の号令" :"at118", | |
}; | |
auto_skill_names_2 = []; | |
for(key in auto_skills_2){ | |
auto_skill_names_2.push(key); | |
} | |
// カードファイルリスト拡張 --------------------------------------------------------------------------------- | |
function cardFileListExpand(){ | |
// デッキ画面のみで実行 | |
if(lp.indexOf('/card/deck.php') != -1 | |
|| lp.indexOf('/union/index.php') != -1 | |
|| lp.indexOf('/card/trade_card.php') != -1){ | |
/* 各カード | |
---------------------------------*/ | |
$("#cardFileList .statusDetail").each(function(){ | |
var $target = $(this); | |
var $b_id = $target.find(".statusParameter1 > tbody > tr:nth-child(1) > td:nth-child(2)"); // ID | |
var $b_name = $target.find(".statusParameter1 > tbody > tr:nth-child(2) > td:nth-child(2)"); // 名前 | |
var $b_lv = $target.find(".statusParameter1 > tbody > tr:nth-child(3) > td:nth-child(2)"); // レベル | |
var $b_cost = $target.find(".statusParameter1 > tbody > tr:nth-child(4) > td:nth-child(2)"); // コスト | |
var $b_army = $target.find(".statusParameter1 > tbody > tr:nth-child(5) > td:nth-child(2)"); // 兵科 | |
var $b_hp = $target.find(".statusParameter1 > tbody > tr:nth-child(6) > td:nth-child(2)"); // HP | |
var $b_gauge = $target.find(".statusParameter1 > tbody > tr:nth-child(7) > td:nth-child(2)"); // 討伐 | |
var $b_atk = $target.find(".statusParameter1 > tbody > tr:nth-child(1) > td:nth-child(4)"); // 攻撃 | |
var $b_int = $target.find(".statusParameter1 > tbody > tr:nth-child(2) > td:nth-child(4)"); // 知力 | |
var $b_def_i = $target.find(".statusParameter1 > tbody > tr:nth-child(3) > td:nth-child(4)"); // 歩防 | |
var $b_def_s = $target.find(".statusParameter1 > tbody > tr:nth-child(4) > td:nth-child(4)"); // 槍防 | |
var $b_def_a = $target.find(".statusParameter1 > tbody > tr:nth-child(5) > td:nth-child(4)"); // 弓防 | |
var $b_def_c = $target.find(".statusParameter1 > tbody > tr:nth-child(6) > td:nth-child(4)"); // 騎防 | |
var $b_speed = $target.find(".statusParameter1 > tbody > tr:nth-child(7) > td:nth-child(4)"); // 速度 | |
var $b_exp = $target.find(".statusParameter2 > tbody > tr:nth-child(1) > td"); // exp | |
var $b_score = $target.find(".statusParameter2 > tbody > tr:nth-child(2) > td"); // スコア | |
var $b_skill = []; | |
$b_skill[0] = $target.find(".statusParameter2 > tbody > tr:nth-child(3) > td"); // スキル1 | |
$b_skill[1] = $target.find(".statusParameter2 > tbody > tr:nth-child(4) > td"); // スキル2 | |
$b_skill[2] = $target.find(".statusParameter2 > tbody > tr:nth-child(5) > td"); // スキル3 | |
$b_skill[3] = $target.find(".statusParameter2 > tbody > tr:nth-child(6) > td"); // スキル4 | |
// card_idの取得とパラメータ保持 | |
var card_id = $target.find("a.thickbox").attr("href").match(/\d+/g)[2]; | |
$(this).attr("data-card_id",card_id); | |
/* トレード用 拡張表示 | |
---------------------------------*/ | |
// ID,名前にトレードリンク追加 | |
var b_id = $b_id.text(); | |
var b_name = $b_name.text(); | |
if(OPT_TRADE_LINK){ | |
$b_id.append("<a href=\"/card/trade.php?t=no&k="+b_id+"\">(T)</a>"); | |
$b_name.append("<a href=\"/card/trade.php?t=name&k="+b_name+"\">(T)</a>"); | |
} | |
$($b_skill).each(function(){ | |
var b_skill = $(this).text(); | |
if(b_skill){ | |
var skill_name = b_skill.match(/(.*)LV(\d+)/); | |
/* 自動スキル発動(デッキ画面のみ) | |
-------------------------------------------------------------------------------*/ | |
if(OPT_AUTO_HEAL){ | |
if($.inArray(skill_name[1], auto_skill_names) != '-1' && lp.indexOf('/card/deck.php') != -1){ | |
// スキル自動発動用リンク追加 | |
var $skill_link_obj = $(" <a href=\"javascript:void(0)\">[発動]</a>"); | |
$skill_link_obj.css("font-size","9px"); | |
$skill_link_obj.off("click").on("click",function(){ | |
if(window.confirm("「"+skill_name[1]+"」を発動してもいいかな(。´・ω・)?")){ | |
autoSkillAction($(this),selected_village_id,skill_name); | |
}else{ | |
return false; | |
} | |
}); | |
if(!$(this).closest("tr").hasClass("used") && $(this).closest(".statusDetail").find(".left .set a").length > 0){ | |
$(this).prev("th").append($skill_link_obj); | |
} | |
} | |
} | |
if(OPT_AUTO_SKILL){ | |
if($.inArray(skill_name[1], auto_skill_names_2) != '-1' && lp.indexOf('/card/deck.php') != -1){ | |
// スキル自動発動用リンク追加 | |
var $skill_link_obj = $(" <a href=\"javascript:void(0)\">[発動]</a>"); | |
$skill_link_obj.css("font-size","9px"); | |
$skill_link_obj.off("click").on("click",function(){ | |
if(window.confirm("「"+selected_village_name+"」で「"+skill_name[1]+"」を発動してもいいかな(。´・ω・)?")){ | |
autoSkillAction2($(this),selected_village_id,skill_name); | |
}else{ | |
return false; | |
} | |
}); | |
if(!$(this).closest("tr").hasClass("used") && $(this).closest(".statusDetail").find(".left .set a").length > 0){ | |
$(this).prev("th").append($skill_link_obj); | |
} | |
} | |
} | |
// スキルにトレードリンク追加 | |
if(OPT_TRADE_LINK){ | |
$(this).append("<a href=\"/card/trade.php?t=skill&k="+skill_name[1]+"\">(T)</a>"); | |
} | |
} | |
}); | |
// 即落札チェッカー | |
if(OPT_SBID){ | |
var $link_obj = $("<div class=\"sbid\"><a href=\"javascript:void(0)\">[即落CHECK]</a></div>"); | |
$link_obj.css("font-size","9px"); | |
$link_obj.find("a").off("click").on("click",function(){ | |
var $sbid = $(this).closest(".sbid"); | |
$sbid.empty(); | |
$sbid.html("[CHECK中]"); | |
var oneTradeData = getSbidPrice(parseInt(b_id)); | |
oneTradeData.then( | |
function(data){ | |
// 価格 | |
var sbid_price = $(data).find(".tradeTables > tbody > tr:nth-child(2) > td:nth-child(8)").text(); | |
if(sbid_price){ | |
$sbid.html(sbid_price+"TP"); | |
}else{ | |
$sbid.html("ナイネ(´-ω-`)"); | |
} | |
},function(){ | |
// 失敗時 | |
$sbid.html("エラー(´-ω-`)"); | |
} | |
); | |
}); | |
$target.find("div.left").append($link_obj); | |
} | |
// デッキ一覧に合成メニューを追加 | |
if(OPT_UNION_BOX){ | |
if(lp.indexOf('/card/deck.php') != -1){ | |
var union_param = {}; | |
union_param.cid = card_id; | |
var union_html = (function(param){/* | |
<ul class="union_box"> | |
<li>合成:</li> | |
<li><a href="/union/lvup.php?cid=${cid}">[LVUP]</a></li> | |
<li><a href="/union/learn.php?cid=${cid}">[習得]</a></li> | |
<li><a href="/union/remove.php?cid=${cid}">[削除]</a></li> | |
<li><a href="/union/expup.php?cid=${cid}">[修行]</a></li> | |
</ul> | |
*/}).toString().replace(/(\n)/g, '').split('*')[1]; | |
var union_append_html = $.tmpl(union_html,union_param) || ''; | |
$target.closest(".cardStatusDetail").append(union_append_html); | |
} | |
} | |
}); | |
// デッキ画面のみ | |
if(lp.indexOf('/card/deck.php') != -1){ | |
/* 画面表示改善 | |
---------------------------------*/ | |
if(OPT_DECK_LAYOUT){ | |
$("#cardFileList .otherDetail").hide(); | |
$(".statusDetail .right").append(" <a class=\"show_label\" href=\"javascript:void(0)\">[ラベル表示切替]</a>"); | |
$(".show_label").css("font-size","9px"); | |
$(".show_label").off("click").on("click",function(){ | |
$(".cardStatusDetail").find(".otherDetail").toggle(); | |
}); | |
$(".cardStatusDetail .dis_set_mini").css("white-space","nowrap"); | |
} | |
/* 合成メニュー用 | |
---------------------------------*/ | |
$(".union_box").css({ | |
"width":"235px", | |
"display":"table", | |
"table-layout":"fixed", | |
"margin-top":"3px" | |
}); | |
$(".union_box > li").css({ | |
"display":"table-cell", | |
"font-size":"9px" | |
}); | |
$(".union_box > li a").css("color","#94596A"); | |
/* デッキセット初期値 | |
---------------------------------*/ | |
// 各拠点ID | |
// ※ファイルリスト画面のみで取得可 | |
var village_ids = []; | |
$("#deck_add_selected_village option").each(function(){ | |
village_ids.push($(this).attr("value")); | |
}); | |
// 未選択の拠点ID | |
var unset_village_ids = []; | |
var village_list = j$("div .sideBoxHead:contains(拠点)")[0].closest(".sideBox"); | |
$(village_list).find(".sideBoxInner ul li a:first-child").each(function(){ | |
unset_village_ids.push($(this).attr("href").match(/\d+/g)[0]); | |
}); | |
// 選択中の拠点IDを取得 | |
var selected_village_id = ""; | |
var selected_village_name = $("#deck_add_selected_village option:selected").text(); | |
if(village_ids.length > 0){ | |
$(village_ids).each(function(index,value){ | |
var village_id = value; | |
if($.inArray(village_id, unset_village_ids) == '-1'){ | |
selected_village_id = value; | |
} | |
}); | |
} | |
/* 15.11.11 メンテにて公式が対応したのでコメントアウト | |
// 初期値を選択状態にする | |
$("#deck_add_selected_village").val(selected_village_id); | |
*/ | |
/* デッキダウン機能 | |
---------------------------------*/ | |
if(OPT_DECK_DOWN){ | |
// デッキで待機中のファイルを降ろす | |
var ddown_html = (function(){/* | |
<ul id="deckdown_control"> | |
<li>待機中の武将をデッキから降ろす:</li> | |
<li class="func"><a href="javascript:void(0)" data-mode="full">[全て]</a></li> | |
<li class="func"><a href="javascript:void(0)" data-mode="zengun">[全軍スキルを持った武将を除く]</a></li> | |
<li class="func"><a href="javascript:void(0)" data-mode="hpfull">[HP全快の武将のみ]</a></li> | |
<li class="process">処理中(-ω-`)</li> | |
</ul> | |
*/}).toString().replace(/(\n)/g, '').split('*')[1]; | |
var ddown_append_html = $.tmpl(ddown_html,{}) || ''; | |
$("#deck-head").append(ddown_append_html); | |
$("#deckdown_control").css({ | |
"display":"table", | |
"table-layout":"fixed", | |
"margin-top":"3px", | |
"float":"right" | |
}); | |
$("#deckdown_control > li").css({ | |
"padding-right":"1em", | |
"display":"table-cell", | |
"font-size":"11px" | |
}); | |
$("#deckdown_control > li a").css("color","#94596A"); | |
$("#deckdown_control li.process").css({"display":"none","color":"#FF0000"}); | |
$(document).on("click","#deckdown_control a",function(){ | |
var deck_down_ids = []; | |
var deck_down_datas = []; | |
var mode = $(this).attr("data-mode"); | |
$("#deckdown_control > li.func").hide(); | |
$("#deckdown_control > li.process").show(); | |
$("#cardListDeck .cardColmn").each(function(){ | |
var $deck_card_obj = $(this).find(".control > div > a > img"); | |
if($deck_card_obj.length){ | |
var deck_card_id = $deck_card_obj.attr("onclick").match(/\d+/g)[0]; | |
var deck_card_hp = $(this).find(".status_hp .value").text().match(/\d+/g)[0]; | |
var deck_card_zengun = $(this).is(":contains('全軍の')"); | |
switch (mode) { | |
case 'full': | |
deck_down_ids.push(deck_card_id); | |
break; | |
case 'hpfull': | |
if(deck_card_hp == 100){ | |
deck_down_ids.push(deck_card_id); | |
} | |
break; | |
case 'zengun': | |
if(!deck_card_zengun){ | |
deck_down_ids.push(deck_card_id); | |
} | |
break; | |
} | |
} | |
}); | |
$(deck_down_ids).each(function(index,value){ | |
var d_deckdown = deckChange('unset',value); | |
deck_down_datas.push(d_deckdown); | |
}); | |
$.when.apply($,deck_down_datas).then( | |
function(){ | |
$("#deckdown_control > li.process").text("処理完了したので画面更新するよ(-ω-`)"); | |
location.reload(); // デッキダウン完了→画面更新 | |
} | |
); | |
}); | |
} | |
} | |
// 武将ソートボタン | |
if(OPT_BUSHO_SORT){ | |
makeSortButton(); | |
} | |
} | |
} | |
// Run | |
$(document).ready(function(){ | |
cardFileListExpand(); | |
}); | |
// トレードページのデータ取得 | |
function getTradePage(param){ | |
var d = new $.Deferred; | |
var page = param.page || 1; | |
$.ajax({ | |
type: 'get', | |
url: '/card/trade.php', | |
dataType: 'html', | |
data:{ | |
't': param.type, // 検索タイプ | |
'k': param.keyword, // キーワード | |
's': param.sort, // ソートタイプ | |
'o': param.order, // ORDER | |
'r_l': param.rare_l, // L | |
'r_ur': param.rare_ur, // UR | |
'r_sr': param.rare_sr, // SR | |
'r_r': param.rare_r, // R | |
'r_uc': param.rare_uc, // UC | |
'r_c': param.rare_c, // C | |
'lim': param.limit, // 公開期限 | |
'tl': param.tplack , // TP不足 | |
} | |
}).then( | |
function(data){ | |
d.resolve(data); | |
},function(data){ | |
d.reject(); | |
} | |
); | |
return d.promise(); | |
} | |
// 即落札価格の取得 | |
function getSbidPrice(card_no){ | |
if(!$.isNumeric(card_no)){ | |
return false; | |
} | |
// 即落札用パラメータ | |
var param = {}; | |
param.keyword = card_no; | |
param.type = 'no'; | |
param.sort = 'price'; | |
param.order = 'a'; | |
param.rare_l = 1; | |
param.rare_ur = 1; | |
param.rare_sr = 1; | |
param.rare_r = 1; | |
param.rare_uc = 1; | |
param.rare_c = 1; | |
param.limit = 0; | |
var oneTradeData = getTradePage(param); | |
return oneTradeData; | |
} | |
// デッキ セット/解除 | |
function deckChange(mode,card_id,village_id){ | |
var d = new $.Deferred; | |
var mode = mode || 'set'; | |
var ssid = getCookie("SSID"); | |
var param = {}; | |
param['ssid'] = ssid; | |
param['mode'] = mode; | |
param['target_card'] = card_id; | |
param['selected_village['+card_id+']'] = village_id; | |
$.ajax({ | |
type: 'post', | |
url: '/card/deck.php', | |
dataType: 'html', | |
data:param | |
}).then( | |
function(data){ | |
d.resolve(data); | |
},function(data){ | |
d.reject(); | |
} | |
); | |
return d.promise(); | |
} | |
// 内政チェッカー | |
// 内政官がセットされている場合はTRUE | |
function domesticChecker(){ | |
var d = new $.Deferred; | |
$.ajax({ | |
type: 'get', | |
url: '/card/domestic_setting.php', | |
dataType: 'html' | |
}).then( | |
function(data){ | |
var domestic_data = $(data).find(".commonTables .general:contains('内政中')"); | |
if(domestic_data.length){ | |
d.resolve(true); | |
}else{ | |
d.resolve(false); | |
} | |
},function(data){ | |
d.reject(); | |
} | |
); | |
return d.promise(); | |
} | |
// 内政 セット/解除/skill発動 | |
function domesticChange(mode,card_id,skill_id){ | |
var d = new $.Deferred; | |
var param = {}; | |
param['mode'] = mode; // domestic,u_domestic,skill | |
param['id'] = card_id; | |
param['sid'] = skill_id; | |
$.ajax({ | |
type: 'get', | |
url: '/card/domestic_setting.php', | |
dataType: 'html', | |
data : param | |
}).then( | |
function(data){ | |
d.resolve(); | |
},function(data){ | |
d.reject(); | |
} | |
); | |
return d.promise(); | |
} | |
// 自動スキル発動 | |
// 仁君君の処理フローを参考にカスタマイズ | |
function autoSkillAction($target,village_id,skill){ | |
var card_id = $target.closest(".statusDetail").attr("data-card_id"); | |
var $auto_skill_info = $("<div id=\"auto_skill_info\">aaa</div>"); | |
$target.closest("th").css({ | |
'position':'relative' | |
}); | |
$auto_skill_info.css({ | |
'top':'0', | |
'left':'0', | |
'right':'0', | |
'bottom':'0', | |
'font':'10px', | |
'line-heigt':'11px', | |
'color':'yellow', | |
'background-color':'#000', | |
'position':'absolute' | |
}); | |
$target.append($auto_skill_info); | |
var $auto_skill_text = $target.find("#auto_skill_info"); | |
// 内政セット済みの武将がいないかチェック | |
$auto_skill_text.text("内政設定確認中(-ω-`)"); | |
var d_checker = domesticChecker(); | |
d_checker.then( | |
function(result){ | |
if(result){ | |
// 内政官がセット済み | |
alert("(´・ω・`)もう内政官が居るッス"); | |
$auto_skill_text.remove(); | |
$target.css({ | |
'pointer-events': 'auto' | |
}); | |
}else{ | |
// 内政官のデッキアップ処理へ | |
$auto_skill_text.text("デッキアップ(-ω-`)"); | |
var d_deckup = deckChange('set',card_id,village_id); | |
d_deckup.then( | |
function(){ | |
// デッキアップ完了→内政設定 | |
$auto_skill_text.text("内政設定(-ω-`)"); | |
var d_dchange = domesticChange('domestic',card_id); | |
d_dchange.then( | |
function(){ | |
// 内政設定完了→スキル発動 | |
$auto_skill_text.text("スキル発動(・ω・´)"); | |
var skill_name = skill[1]; | |
var skill_lv = skill[2] - 1; | |
var skill_code = auto_skills[skill_name]+skill_lv; | |
var d_dskill = domesticChange('skill',card_id,skill_code); | |
d_dskill.then( | |
function(){ | |
// スキル発動完了→内政設定解除 | |
$auto_skill_text.text("内政解除(-ω-`)"); | |
var d_duchange = domesticChange('u_domestic',card_id); | |
d_duchange.then( | |
function(){ | |
// 内政設定解除完了→デッキダウン | |
$auto_skill_text.text("デッキダウン(-ω-`)"); | |
var d_deckdown = deckChange('unset',card_id); | |
d_deckdown.then( | |
function(){ | |
$auto_skill_text.text("画面更新(-ω-`)"); | |
// デッキダウン完了→画面更新 | |
location.reload(); | |
} | |
); | |
} | |
); | |
} | |
); | |
} | |
); | |
} | |
); | |
} | |
} | |
); | |
} | |
// 自動スキル発動(デッキから降ろさない) | |
function autoSkillAction2($target,village_id,skill){ | |
var card_id = $target.closest(".statusDetail").attr("data-card_id"); | |
var $auto_skill_info = $("<div id=\"auto_skill_info\">aaa</div>"); | |
$target.closest("th").css({ | |
'position':'relative' | |
}); | |
$auto_skill_info.css({ | |
'top':'0', | |
'left':'0', | |
'right':'0', | |
'bottom':'0', | |
'font':'10px', | |
'line-heigt':'11px', | |
'color':'yellow', | |
'background-color':'#000', | |
'position':'absolute' | |
}); | |
$target.append($auto_skill_info); | |
var $auto_skill_text = $target.find("#auto_skill_info"); | |
// 内政セット済みの武将がいないかチェック | |
$auto_skill_text.text("内政設定確認中(-ω-`)"); | |
var d_checker = domesticChecker(); | |
d_checker.then( | |
function(result){ | |
if(result){ | |
// 内政官がセット済み | |
alert("(´・ω・`)もう内政官が居るッス"); | |
$auto_skill_text.remove(); | |
$target.css({ | |
'pointer-events': 'auto' | |
}); | |
}else{ | |
// 内政官のデッキアップ処理へ | |
$auto_skill_text.text("デッキアップ(-ω-`)"); | |
var d_deckup = deckChange('set',card_id,village_id); | |
d_deckup.then( | |
function(){ | |
// デッキアップ完了→内政設定 | |
$auto_skill_text.text("内政設定(-ω-`)"); | |
var d_dchange = domesticChange('domestic',card_id); | |
d_dchange.then( | |
function(){ | |
// 内政設定完了→スキル発動 | |
$auto_skill_text.text("スキル発動(・ω・´)"); | |
var skill_name = skill[1]; | |
var skill_lv = skill[2] - 1; | |
var skill_code = auto_skills_2[skill_name]+skill_lv; | |
var d_dskill = domesticChange('skill',card_id,skill_code); | |
d_dskill.then( | |
function(){ | |
// スキル発動完了→画面更新 | |
$auto_skill_text.text("画面更新(-ω-`)"); | |
location.reload(); | |
} | |
); | |
} | |
); | |
} | |
); | |
} | |
} | |
); | |
} | |
/* Gyazo画像表示対応 カスタム | |
------------------------------------------------------------------------------*/ | |
// オリジナル | |
// ブラウザ三国志用プロフ画像埋め込みスクリプト | |
// Scripted by KfmAdmin | |
// http://kfm.netgamers.jp/bura3/script.php | |
// プロフ,掲示板,書簡,同盟トップで実行 | |
if(OPT_GYAZO){ | |
if(lp.indexOf('/user/') != -1){ | |
$(".show_comment_cell[rowspan=2]").html(conv($(".show_comment_cell[rowspan=2]").html())); | |
$(".show_comment_cell[rowspan=2]").next().html(conv($(".show_comment_cell[rowspan=2]").next().html())); | |
}else if(lp.indexOf('/bbs/') != -1 || lp.indexOf('/message/') != -1 || lp.indexOf('/alliance/info.php') != -1){ | |
$(".commonTables td").each(function(){ | |
if(!$(this).find("textarea").length){ | |
var conv_html = conv($(this).html()); | |
$(this).html(conv_html); | |
} | |
}); | |
} | |
} | |
function conv(scr){ | |
if ( null == scr ){ return null; } | |
//改行削除 | |
scr = scr.replace(/[\n\r]/g, ""); | |
//brタグ -> 改行 | |
scr = scr.replace(/(<br \/>|<br>)/ig, "\n"); | |
//gyazoを処理 | |
var gyazo_reg = /(http(s?):\/\/(.+\.)?gyazo.com\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&\=+\$,%#]+).png/gi; | |
var gyazo_reg2 = /(http(s?):\/\/(.+\.)?gyazo.com\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&\=+\$,%#]+)/gi; | |
scr = scr.replace(gyazo_reg, "$1"); | |
scr = scr.replace(gyazo_reg2, | |
"<div><a href='$1' target=_blank><img src='$1.png' style=\"max-width:300px; margin: 2px; border:solid 1px #d3d3d3\" /></a></div>"); | |
//改行 -> brタグ | |
scr = scr.replace(/[\n\r]/g, "<br />"); | |
return scr; | |
} | |
/* Pager拡張 | |
------------------------------------------------------------------------------*/ | |
function makePageLinks(){ | |
if($("ul.pager").length > 0){ | |
var last_page_num = $("ul.pager li.last").eq(0).prev().text(); | |
if(!last_page_num){ | |
last_page_num = $("ul.pager li:last-child").eq(0).text(); | |
} | |
var file_path = window.location.pathname; | |
var getParam = getParameter(); | |
if(getParam.p == void(0)){ | |
getParam.p = 1; | |
} | |
var view_page = getParam.p; | |
delete getParam.p; | |
var param_url = ''; | |
$.each(getParam,function(index,value){ | |
param_url += index+"="+value+"&"; | |
}); | |
var $select_elm = $("<select class='pyPageLink' style='width:4em;' onChange='location.href=value;'>"); | |
var $option_li = $("<option>"); | |
var $wrapper_li = $("<li>"); | |
for(var i=1;i<=last_page_num;i++){ | |
var $option_line = $option_li.clone(); | |
$option_line.attr({ | |
value:file_path+"?"+ param_url +"p="+i+"#file-1", | |
text:" "+i+" " | |
}); | |
$option_line.text(" "+i+" "); | |
$select_elm.append($option_line); | |
} | |
$wrapper_li.append($select_elm); | |
$("ul.pager").append($wrapper_li); | |
$("select[class='pyPageLink']").find("option:nth-child("+ view_page +")").attr("selected","selected"); | |
} | |
} | |
// Run | |
$(document).ready(function(){ | |
if(OPT_PAGER_EXTEND){ | |
makePageLinks(); | |
} | |
}); | |
/* 武将ソートボタン | |
------------------------------------------------------------------------------*/ | |
function makeSortButton(){ | |
var tmpl_html = (function(){/* | |
<ul id="busho_sort"> | |
<li><a id="" data-sort_order="2">レア</a></li> | |
<li><a id="" data-sort_order="3">Lv</a></li> | |
<li><a id="" data-sort_order="9">攻</a></li> | |
<li><a id="" data-sort_order="10">知</a></li> | |
<li><a id="" data-sort_order="11">歩防</a></li> | |
<li><a id="" data-sort_order="12">槍防</a></li> | |
<li><a id="" data-sort_order="13">弓防</a></li> | |
<li><a id="" data-sort_order="14">騎防</a></li> | |
<li><a id="" data-sort_order="15">速</a></li> | |
</ul> | |
<style> | |
<!-- | |
#busho_sort{ | |
position:absolute; | |
} | |
#busho_sort > li{ | |
float:left; | |
cursor:pointer; | |
} | |
#busho_sort > li > a{ | |
display:block; | |
background-color:#000000; | |
color:#FFFFFF; | |
padding:3px; | |
margin:2px; | |
} | |
--> | |
</style> | |
*/}).toString().replace(/(\n)/g, '').split('*')[1]; | |
var html = $.tmpl(tmpl_html,{}) || ''; | |
// 投稿ボタンの設置 | |
$("#wrapper").append(html); | |
// 投稿ボタンへEvent設定 | |
$("#busho_sort a").off('click').on('click',function(){ | |
// デュエル参加武将情報の取得 | |
var sort_order = $(this).attr("data-sort_order"); | |
// SSID | |
var ssid = getCookie("SSID"); | |
var param = {}; | |
param['mode'] = ""; | |
param['target_card'] = ""; | |
param['wild_card_flg'] = ""; | |
param['boost_card_flg'] = ""; | |
param['teach_card_flg'] = ""; | |
param['inc_point'] = ""; | |
param['p'] = 1; | |
param['ssid'] = ssid; | |
param['sort_order'] = [sort_order,0]; | |
param['sort_order_type'] = [1,1]; | |
param['show_deck_card_count'] = $("select[name=show_deck_card_count]").val(); | |
param['btn_change_flg'] = 1; | |
param['l'] = 0; | |
// ソート処理 | |
$.ajax({ | |
type: 'post', | |
url: '/card/deck.php', | |
data: param, | |
}).then( | |
function(){ | |
location.reload(); | |
} | |
); | |
}); | |
} | |
/* 即落札 | |
------------------------------------------------------------------------------*/ | |
// トレード画面で実行 | |
if(OPT_BID){ | |
function makeExhibitLink(exhibit_id){ | |
var $bid_link_obj = $("<div><a href=\"javascript:void(0)\">[落札リンク]</a><input type=\"text\" value=\"http://"+lh+"/card/trade_bid.php?id="+exhibit_id+"\"></div>"); | |
$bid_link_obj.css({ | |
"position":"relative", | |
}); | |
$bid_link_obj.find("a").css({ | |
"font-size":"8px" | |
}); | |
$bid_link_obj.find("input").css({ | |
"width":"350px", | |
"position":"absolute", | |
"display":"none", | |
"left":"0", | |
"top":"1.1em", | |
"border":"1px solid #CCCCCC", | |
"padding":"3px", | |
"background-color":"#FFFFEE", | |
}); | |
$bid_link_obj.find("input").off("click").on("click",function(){ | |
$(this).select(); | |
}); | |
$bid_link_obj.find("a").off("click").on("click",function(){ | |
$(this).closest("div").find("input").slideToggle(100); | |
}); | |
return $bid_link_obj; | |
} | |
if(lp.indexOf('/card/trade.php') != -1){ | |
var now_date = new Date(); | |
var o_date = now_date.getFullYear() + "-" + (now_date.getMonth()+1) + "-" + (now_date.getDate()+1); | |
$(".tradeTables tr:first-child").append("<td style=\"text-align:center;background-color:#ef9ea0;\"><span style=\"white-space:nowrap\">即落札</span></td>"); | |
$(".tradeTables tr:gt(0)").each(function(){ | |
// bro3 favoritetrade 参考 | |
var reg = /inlineId=cardWindow_([0-9]*)[\s\S]*?trade_bid.php\?id=([0-9]*)(\S*)"\>/ | |
var exhibit = $(this).html().match(reg); | |
if(exhibit === null){ // TP不足対応 | |
$(this).append("<td></td>"); | |
return; | |
} | |
var exhibit_cid = exhibit[1]; // カードID | |
var exhibit_id = exhibit[2]; // トレードID | |
var $bid_link_obj = makeExhibitLink(exhibit_id); | |
$(this).find("td:first-child").append($bid_link_obj); | |
if($(this).find(".limit").text() == "---"){ | |
// 落札用リンク追加 | |
var $trade_link_obj = $(" <td><a href=\"javascript:void(0)\">[落札]</a></td>"); | |
$trade_link_obj.css({ | |
"text-align":"center" | |
}); | |
$trade_link_obj.off("click").on("click",function(){ | |
$(this).css("font-size","10px"); | |
$(this).html("処理中<br>(-ω-`)"); | |
bidAction($(this),exhibit_cid,exhibit_id); | |
}); | |
$(this).append($trade_link_obj); | |
}else{ | |
$(this).append("<td></td>"); | |
var limit_datetime = $(this).find(".limit").text().match(/([0-9]{4})\-([0-9]{2})\-([0-9]{2})([0-9]{2})\:([0-9]{2})*/) | |
var limit_time = new Date(limit_datetime[1],limit_datetime[2]-1,limit_datetime[3],limit_datetime[4],limit_datetime[5],0,0); | |
if((now_date.getTime() + 86400000) < limit_time.getTime()){ | |
$(this).find("td").css("background-color","#FFF0F5"); | |
} | |
} | |
}); | |
} | |
// 出品リンク | |
if(lp.indexOf('/card/exhibit_list.php') != -1){ | |
$(".tradeTables tr:gt(0)").each(function(){ | |
var exhibit_id = $(this).find(".trade a").attr("href").match(/\d+/g)[0]; | |
var $exhibid_link_obj = makeExhibitLink(exhibit_id); | |
$(this).find("td:first-child").append($exhibid_link_obj); | |
}); | |
} | |
} | |
// 落札処理 | |
function bidAction(target,exhibit_cid,exhibit_id){ | |
var ssid = getCookie("SSID"); | |
var param = {}; | |
param['ssid'] = ssid; | |
param['exhibit_cid'] = exhibit_cid; | |
param['exhibit_id'] = exhibit_id; | |
param['buy_btn'] = '落札する'; | |
$.ajax({ | |
type: 'post', | |
url: '/card/trade_bid.php', | |
dataType: 'html', | |
data:param | |
}).then( | |
function(data){ | |
target.html("完了<br>(・ω・´)"); | |
},function(data){ | |
} | |
); | |
} | |
/* トレード書簡の削除 | |
------------------------------------------------------------------------------*/ | |
function tradeShokanDel(targetText){ | |
var shokan_ids = []; | |
$(".commonTables tr").each(function(){ | |
var unreadBID = $(this).is(":contains('"+targetText+"')"); | |
if(unreadBID){ | |
var shokan_id = $(this).find("td:first-child input").val(); | |
shokan_ids.push(shokan_id); | |
} | |
}); | |
if(shokan_ids.length > 0){ | |
var shokan_readed_datas = []; | |
$(shokan_ids).each(function(index,value){ | |
var d_readed = readedShokan(value); | |
shokan_readed_datas.push(d_readed); | |
}); | |
$.when.apply($,shokan_readed_datas).then( | |
function(){ | |
// 書簡の既読処理完了 | |
$("#del_inbox_menu").html("<li>モウチョット(´-ω-`)</li>"); | |
var shokan_delete_datas = []; | |
$(shokan_ids).each(function(index,value){ | |
var d_delete = deleteShokan(value); | |
shokan_delete_datas.push(d_delete); | |
}); | |
$.when.apply($,shokan_delete_datas).then( | |
function(){ | |
// 書簡の削除完了 - リロード | |
$("#del_inbox_menu").html("<li>完了(`・ω・´)</li>"); | |
location.reload(); | |
} | |
); | |
} | |
); | |
}else{ | |
// リロード | |
$("#del_inbox_menu").html("<li>対象が見つからないよ(´・ω・`)</li>"); | |
location.reload(); | |
} | |
} | |
function readedShokanList(){ | |
var shokan_ids = []; | |
$(".commonTables tr.unread").each(function(){ | |
var shokan_id = $(this).find("td:first-child input").val(); | |
shokan_ids.push(shokan_id); | |
}); | |
if(shokan_ids.length > 0){ | |
var shokan_readed_datas = []; | |
$(shokan_ids).each(function(index,value){ | |
var d_readed = readedShokan(value); | |
shokan_readed_datas.push(d_readed); | |
}); | |
$.when.apply($,shokan_readed_datas).then( | |
function(){ | |
$("#del_inbox_menu").html("<li>完了(`・ω・´)</li>"); | |
location.reload(); | |
} | |
); | |
}else{ | |
// リロード | |
$("#del_inbox_menu").html("<li>対象が見つからないよ(´・ω・`)</li>"); | |
location.reload(); | |
} | |
} | |
// 書簡を既読化 | |
function readedShokan(shokan_id){ | |
var d = new $.Deferred; | |
var param = {}; | |
param['m'] = 'inbox'; | |
param['p'] = 1; | |
param['id'] = shokan_id; | |
$.ajax({ | |
type: 'get', | |
url: '/message/detail.php', | |
dataType: 'html', | |
data:param | |
}).then( | |
function(data){ | |
d.resolve(data); | |
},function(data){ | |
d.reject(); | |
} | |
); | |
return d.promise(); | |
} | |
// 書簡を削除 | |
function deleteShokan(shokan_id){ | |
var d = new $.Deferred; | |
var ssid = getCookie("SSID"); | |
var param = {}; | |
param['ssid'] = ssid; | |
param['mode'] = 'inbox'; | |
param['p'] = 1; | |
param['chk[]'] = shokan_id; | |
$.ajax({ | |
type: 'post', | |
url: '/message/delete.php', | |
dataType: 'html', | |
data:param | |
}).then( | |
function(data){ | |
d.resolve(data); | |
},function(data){ | |
d.reject(); | |
} | |
); | |
return d.promise(); | |
} | |
if(OPT_BID_SHOKAN){ | |
if(lp.indexOf('/message/inbox.php') != -1){ | |
// Run | |
$(document).ready(function(){ | |
var inbox_param = {}; | |
var inbox_del_html = (function(param){/* | |
<ul id="del_inbox_menu"> | |
<li class="acheck_btn"><a href="javascript:void(0)">全てを選択</a> </li> | |
<li class="read_btn"><a href="javascript:void(0)">全ての書簡を既読状態にする</a> </li> | |
<li class="unread_btn"><a href="javascript:void(0)">【即時落札した】書簡を削除</a> </li> | |
<li class="reward_btn"><a href="javascript:void(0)">【ログイン報酬】書簡を削除</a> </li> | |
</ul> | |
*/}).toString().replace(/(\n)/g, '').split('*')[1]; | |
var $inbox_append_html = $.tmpl(inbox_del_html,inbox_param) || ''; | |
$inbox_append_html.css({ | |
"font-size":"11px" | |
}); | |
$inbox_append_html.find("li").css({ | |
"float":"left", | |
"margin-bottom":"5px", | |
}); | |
// 既読状態にする | |
$inbox_append_html.find(".read_btn a").off("click").on("click",function(){ | |
$(this).closest("ul").html("<li>既読処理開始(´-ω-`)</li>"); | |
readedShokanList(); | |
}); | |
// 【即時落札】カードを落札しました 削除 | |
$inbox_append_html.find(".unread_btn a").off("click").on("click",function(){ | |
$(this).closest("ul").html("<li>削除処理開始(´-ω-`)</li>"); | |
tradeShokanDel('【即時落札】カードを落札しました'); | |
}); | |
// 合計ログインボーナス報酬付与のお知らせ 削除 | |
$inbox_append_html.find(".reward_btn a").off("click").on("click",function(){ | |
$(this).closest("ul").html("<li>削除処理開始(´-ω-`)</li>"); | |
tradeShokanDel('合計ログインボーナス報酬付与'); | |
}); | |
// 全チェック | |
$inbox_append_html.find(".acheck_btn a").off("click").on("click",function(){ | |
$(".commonTables input[type=checkbox]").prop("checked", true); | |
}); | |
$("#statMenu").after($inbox_append_html); | |
}); | |
} | |
} | |
/* 汎用Function | |
-----------------------------------------------------------------------------------------------------------------*/ | |
// Cookie情報取得Function | |
function getCookie(key){ | |
var cookieString = document.cookie; | |
var cookieKeyArray = cookieString.split(";"); | |
for(var i=0; i < cookieKeyArray.length; i++){ | |
var targetCookie = cookieKeyArray[i]; | |
targetCookie = targetCookie.replace(/^\s+|\s+$/g, ""); | |
var valueIndex = targetCookie.indexOf("="); | |
if(targetCookie.substring(0, valueIndex) == key){ | |
return unescape(targetCookie.slice(valueIndex + 1)); | |
} | |
} | |
return ""; | |
} | |
// Get URL parameters | |
function getParameter() { | |
var arg = new Object; | |
var pair = location.search.substring(1).split('&'); | |
for(i=0; pair[i]; i++) { | |
var kv = pair[i].split('='); | |
arg[kv[0]] = kv[1]; | |
} | |
return arg; | |
} | |
})(j$); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment