Created
May 25, 2012 12:56
-
-
Save ahomu/2787958 to your computer and use it in GitHub Desktop.
#ablogcms 管理ページ直行ボタンつくるくん
This file contains hidden or 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
javascript:(function(a,b){function e(a,b){return b?'<input type="hidden" name="'+a+'" value="'+b+'" />':void 0}function f(){var a=b.search.substr(1).split("&"),c=0,d=a.length,e,f=[];if(!b.search){return}for(;c<d;c++){e=a[c].split("=");f.push('<input type="hidden" name="'+e[0]+'" value="'+e[1]+'" />');f.push('<input type="hidden" name="query[]" value="'+e[0]+'" />')}return f.join("\n")}if(!ACMS.Config.admin){alert("%E7%AE%A1%E7%90%86%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%A7%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%A6%E3%81%AD");return}var c=a.querySelectorAll("#topicpath li:last-child")[0].innerText.replace("> ",""),d=[];d.push('<form action="" method="post">');d.push(e("admin",ACMS.Config.admin));d.push(e("bid",ACMS.Config.bid));d.push(e("cid",ACMS.Config.cid));d.push(e("eid",ACMS.Config.eid));d.push(f());d.push('<input type="submit" name="ACMS_POST_2GET" value="'+c+'" />');d.push("</form>");alert(d.join("\n").replace(/\n{2,}/,"\n"))})(document,location) |
This file contains hidden or 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
(function(doc, loc) { | |
if (!ACMS.Config.admin) { | |
alert('管理ページで実行してね'); | |
return; | |
} | |
var title = doc.querySelectorAll('#topicpath li:last-child')[0].innerText.replace('> ', ''), | |
form = []; | |
form.push('<form action="" method="post">'); | |
form.push(getHidden('admin', ACMS.Config.admin)); | |
form.push(getHidden('bid', ACMS.Config.bid)); | |
form.push(getHidden('cid', ACMS.Config.cid)); | |
form.push(getHidden('eid', ACMS.Config.eid)); | |
form.push(getQueries()); | |
form.push('<input type="submit" name="ACMS_POST_2GET" value="'+title+'" />'); | |
form.push('</form>'); | |
function getHidden(name, value) { | |
return value ? '<input type="hidden" name="'+name+'" value="'+value+'" />' : void 0; | |
} | |
function getQueries() { | |
var queries = loc.search.substr(1).split('&'), | |
i = 0, iz = queries.length, q, ret = []; | |
if (!loc.search) { | |
return; | |
} | |
for (; i<iz; i++) { | |
q = queries[i].split('='); | |
ret.push('<input type="hidden" name="'+q[0]+'" value="'+q[1]+'" />'); | |
ret.push('<input type="hidden" name="query[]" value="'+q[0]+'" />'); | |
} | |
return ret.join('\n'); | |
} | |
alert(form.join('\n').replace(/\n{2,}/, '\n')); | |
})(document, location); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使い方
bookmarkletとして登録して、管理ページに移動してから実行します
出るモノ
表示中の管理ページに直行するボタンのHTMLがでてきます(alert)
適当にコピペしてつかいます
このままだとaタグリンクと大差ないので、モジュール内変数とかグローバル変数とか組み合わせてあげてください(´・ω・`)