利用者:Kaznyan/monobook.js
ナビゲーションに移動
検索に移動
注意: 保存後、変更を確認するにはブラウザーのキャッシュを消去する必要がある場合があります。
- Firefox / Safari: Shift を押しながら 再読み込み をクリックするか、Ctrl-F5 または Ctrl-R を押してください (Mac では ⌘-R)
- Google Chrome: Ctrl-Shift-R を押してください (Mac では ⌘-Shift-R)
- Internet Explorer / Microsoft Edge: Ctrl を押しながら 最新の情報に更新 をクリックするか、Ctrl-F5 を押してください
- Opera: Ctrl-F5を押してください
/**
Adds a feedback to to the bottom of the page on the left. This has only been tested with Monobook as it is intended for IPs only.
**/
var fb_comment_url = wgScript+
"?title=Wiktionary:フィードバック"+
"&action=edit§ion=new"+
"&preload=Wiktionary:フィードバック%2Fpreload"+
"&editintro=Wiktionary:フィードバック%2Fintro"+
"&preloadtitle="+
encodeURIComponent("[[:"+wgPageName.replace(/_/g, ' ')+"]]");
var fb_thanks = "ご協力ありがとうございました。";
var fb_comment = "ご意見をお寄せください";
var fb_questions = new Array();
fb_questions[0] =
["ウィクショナリーの感想を匿名にて回答ください:",
['良い',
'悪い',
'整理が必要',
'間違いが多い',
'混乱する',
'知りたい単語がない',
'情報が正確でない',
'定義がわかりにくい']
];
var fb_options;
var fb_text;
var fb_sent = false;
var fb_sent2= false;
function fb_init(){
var index = Math.floor(Math.random()*(fb_questions.length));
fb_text = fb_questions[index][0];
fb_options = fb_questions[index][1];
fb_buildBox();
}
function fb_buildBox(){
var sidebar = document.getElementById('column-one');
if(!sidebar) return false;
var list = newNode('ul',{'id':'fb_list'});
for(var i=0;i<fb_options.length;i++){
list.appendChild(
newNode('li',
newNode('a',{'click':fb_click,'id':"FB"+i},fb_options[i])
)
);
}
sidebar.appendChild(
newNode('div',{'class':"portlet",'id':"p-feedback"},
newNode('a',{'name':"feedback"}),
newNode('h5',"feedback"),
newNode('div',{'class':"pBody"},
newNode('p',{'style':'font-size: 90%'},fb_text),
list,
newNode('p',{'style':'font-size: 80%'},
newNode('a',{'href':fb_comment_url},fb_comment)
)
)
)
);
}
$(fb_init);
function fb_click(e){
var fb = false;
var fbi = false;
try{
fb = e.target.childNodes[0].nodeValue;
fbi = e.target.getAttribute('id').replace("FB",'');
}catch(e){ try{
fb = window.event.srcElement.childNodes[0].nodeValue;
fbi = window.event.srcElement.getAttribute('id').replace("FB",'');
} catch(e){ }}
if(fb){
fb_send(fb);
fb_send2(fb,fbi);
}
var list = document.getElementById('fb_list');
list.parentNode.insertBefore(
newNode('p',fb_thanks),list
);
list.parentNode.removeChild(list);
return false;
}
//Send to ~cmackenzie
function fb_send(string){
if(fb_sent) return false;
fb_sent=true;
var wiki = wgServer.replace(/https?:\/\/([^\.]*)\.([^\.]*)\.org/,"$1$2").replace(/pedia$/,'');
var page = wgPageName;
if(wgPageName == 'Special:Search'){
var sb = document.getElementById('lsearchbox');
if(sb) page+='/'+sb.value;
}
var url = "http://tools.wikimedia.de/~cmackenzie/feedback.php"+
"?fb_wiki="+wiki+
"&fb_page="+encodeURI(page)+
"&fb_revid="+encodeURI(wgCurRevisionId)+
"&fb_comment="+encodeURI(string);
document.body.appendChild(
newNode('iframe',{'src':url,'style':'display:none'})
);
}
//Send to ~daveross
function fb_send2(string,indx){
if(fb_sent2) return false;
fb_sent2 =true;
var lang = wgServer.replace(/^https?:\/\/([^\.]*).*$/,"$1");
var wiki = wgServer.replace(/https?:\/\/[^\.]*\.([^\.]*)\.org/,"$1");
var page = wgPageName;
if(wgPageName == 'Special:Search'){
var sb = document.getElementById('lsearchbox');
if(sb) page+='/'+sb.value;
}
var url = 'http://tools.wikimedia.de/~daveross/feedback.php'
+ '?mode=submit'
+ '&lang='+encodeURI(lang)
+ '&wiki='+encodeURI(wiki)
+ '&page='+encodeURI(page)
+ '&revid='+encodeURI(wgCurRevisionId)
+ '&comment='+encodeURI(string)
+ '&comment_index='+encodeURI(indx*1+1);
document.body.appendChild(
newNode('iframe',{'src':url,'style':'display:none'})
);
}
/* DOM abbreviation function */
function newNode(tagname){
var node = document.createElement(tagname);
for( var i=1;i<arguments.length;i++ ){
if(typeof arguments[i] == 'string'){ //Text
node.appendChild( document.createTextNode(arguments[i]) );
}else if(typeof arguments[i] == 'object'){
if(arguments[i].nodeName){ //If it is a DOM Node
node.appendChild(arguments[i]);
}else{ //Attributes (hopefully)
for(var j in arguments[i]){
if(j == 'class'){ //Classname different because...
node.className = arguments[i][j];
}else if(j == 'style'){ //Style is special
node.style.cssText = arguments[i][j];
}else if(typeof arguments[i][j] == 'function'){ //Basic event handlers
try{ node.addEventListener(j,arguments[i][j],false); //W3C
}catch(e){try{ node.attachEvent('on'+j,arguments[i][j],"Language"); //MSIE
}catch(e){ node['on'+j]=arguments[i][j]; }}; //Legacy
}else{
node.setAttribute(j,arguments[i][j]); //Normal attributes
}
}
}
}
}
return node;
}