ผู้ใช้:Spacebirdy/custom.js
หมายเหตุ: หลังเผยแพร่ คุณอาจต้องล้างแคชเว็บเบราว์เซอร์ของคุณเพื่อดูการเปลี่ยนแปลง
- ไฟร์ฟอกซ์ / ซาฟารี: กด Shift ค้างขณะคลิก Reload หรือกด Ctrl-F5 หรือ Ctrl-R (⌘-R บนแมค)
- กูเกิล โครม: กด Ctrl-Shift-R (⌘-Shift-R บนแมค)
- อินเทอร์เน็ตเอกซ์พลอเรอร์ และ Edge: กด Ctrl ค้างขณะคลิก Refresh หรือกด Ctrl-F5
- โอเปร่า: กด Ctrl-F5
/*
== Javascript to perform the CSS insertions ==
*/
if ( $.cookie('WiktionaryUseJSPreferences') == 'true' ) {
// CSS Insertions
if ( $.cookie('WiktionaryPreferencesHideSiteNotice') == 'true' ) mw.util.addCSS( '#siteNotice { display: none; }' );
//no button for this yet...
mw.util.addCSS( '#bodyContent .allpagesredirect { text-decoration:line-through }' );
//Additional optional JavaScript insertions
if ( $.cookie('WiktionaryPreferencesPopUps') == 'true' ) {
// [[w:User:Lupin/popups.js]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s');
} //end of popups
/*
if ( $.cookie('WiktionaryPreferencesKeyPad') == 'true' ) importScript('User:Spacebirdy/keypad.js');
*/
// End of If (UsePreferences) block
}
//array of images
enWiktPrefButtons = [] ;
/* </pre>
== wiktAddButton ==
<pre> */
// generate buttons
function wiktAddButton(cookieToToggle, speedTip) {
var checkbox = document.createElement("input");
checkbox.type = 'checkbox';
checkbox.name = cookieToToggle;
checkbox.onclick = function() {
if ( $.cookie(this.name) != 'true' ) {
$.cookie(this.name, 'true');
} else {
$.cookie(this.name, 'false');
}
}
if ( 'true' == $.cookie( cookieToToggle ) ) {
checkbox.checked = true ;
}
var isPreferencePage = document.getElementById('isPreferencePage');
isPreferencePage.appendChild( checkbox );
if ( 'true' == $.cookie( cookieToToggle ) ) {
checkbox.checked = true ;
}
var text = document.createTextNode( speedTip );
isPreferencePage.appendChild( text );
var text = document.createElement( 'br' );
isPreferencePage.appendChild( text );
return true;
}
//not used just yet
function wiktAddTextBox(cookieToInput, speedTip) {
var textbox = document.createElement("input");
textbox.type = 'text';
textbox.width = 10;
textbox.name = cookieToInput;
textbox.onchange = function() {
$.cookie(this.name, this.value);
}
textbox.value = $.cookie( cookieToInput );
isPreferencePage.appendChild( textbox );
var text = document.createTextNode( speedTip );
isPreferencePage.appendChild( text );
return true;
}
/* </pre>
== CustomizePreferencesPage==
<pre> */
function CustomizePreferencesPage() {
var isPreferencePage = document.getElementById('isPreferencePage');
if ( !isPreferencePage ) return;
//OK, so now we know we are on
//the Set EnglishWiktionary-specific Preferences page (or impersonation thereof)
// http://tools.wikimedia.de/~cmackenzie/make_buttons.html
// crop image to 21 pixels vertical, whatever horizontal.
wiktAddButton( 'WiktionaryUseJSPreferences', 'ใช้การตั้งค่าที่ถูกตั้งไว้แล้วในเว็บนี้!');
wiktAddButton( 'WiktionaryPreferencesHideSiteNotice', 'ซ่อนประกาศของเว็บ');
//TODO: Add color selections for all box-things.
// [[User:Lupin/popups.js]]
wiktAddButton( 'WiktionaryPreferencesPopUps', 'ใช้ [[w:User:Lupin/popups.js]] (ของดั้งเดิมสำหรับวิกิพีเดีย)');
//ดู [[MediaWiki:Monobook.js]]
wiktAddButton( 'WiktionaryPreferencesHideNav', 'ซ่อนส่วนการแปลหรือส่วนที่คล้ายกันทั้งหมด - ค่าปริยายคือ แสดง');
//ดู [[MediaWiki:Monobook.js]]
wiktAddButton( 'WiktionaryPreferencesShowNav', 'แสดงส่วนการแปลหรือที่ส่วนที่คล้ายกัน - ค่าปริยายคือ แสดง');
/* Allow special characters in [Search] input
wiktAddButton( 'WiktionaryPreferencesKeyPad', 'not enabled on th.wikt.');
*/
}
jQuery(document).ready( CustomizePreferencesPage );