Χρήστης:ArielGlenn/custom.js
Σημείωση: μετά την δημοσίευση, ίσως χρειαστεί να παρακάμψετε την προσωρινή μνήμη του προγράμματος περιήγησής σας για να δείτε τις αλλαγές.
- Firefox / Safari: Κρατήστε πατημένο το Shift κάνοντας ταυτόχρονα κλικ στο κουμπί Ανανέωση ή πιέστε Ctrl-F5 ή Ctrl-R (⌘-R σε Mac)
- Google Chrome: Πιέστε Ctrl-Shift-R (⌘-Shift-R σε Mac)
- Internet Explorer / Edge: Κρατήστε πατημένο το Ctrl κάνοντας ταυτόχρονα κλικ στο κουμπί Ανανέωση, ή πιέστε Ctrl-F5
- Opera: Πιέστε Ctrl-F5.
/* [[WT:PREFS]]-specific cookie handling
1/25/2007
Warning: The numbers associated with each preference must not be changed. (The cookie that stores preferences
is written as a sequence of preference values without the corresponding preference names.) */
var prefs = { WiktionaryUseJSPreferences : 1,
WiktionaryPreferencesTime : 2,
WiktionaryPreferencesPopUps : 3,
WiktPrefPatrol : 4,
WiktHideLogo : 5};
/* Warning: The numbers associated with each preference must not be changed. (The cookie that stores preferences
is written as a sequence of preference values without the corresponding preference names.) */
var tempC = '';
function wiktGetPrefCookie(wiktPrefName) {
//When we have a few hundred prefs, I'll have to do this in binary, instead of text "0" & "1"
tempC = getCookie('WiktPrefs');
var prefa = tempC.split("-") ;
var versi = prefa[0];
//if (versi == 0.1 ) {
if (getCookie(wiktPrefName) == 'true') return 'true';
if (prefa[prefs[wiktPrefName]]) {
if (prefa[prefs[wiktPrefName]] == 1) {
return 'true';
} else return 'false';
} else {
return getCookie(wiktPrefName);
}
//}
}
function wiktSetPrefCookie(wiktPrefName, wiktValue) {
tempC = getCookie('WiktPrefs');
var prefa = tempC.split("-");
var versi = "0.1" + "-";
var wiktVal2 = 0;
if (wiktValue == 'true') wiktVal2 = 1;
if (prefs[wiktPrefName]) {
prefa[prefs[wiktPrefName]] = wiktVal2;
} else {
setCookie(wiktPrefName, wiktValue);
return;
}
for (var i in prefs) {
if ( prefa[prefs[i]] ) {
if ( wiktPrefName == i ) {
versi += wiktVal2 + "-";
deleteCookie(i);
} else {
if ( wiktGetPrefCookie(i) == 'true' ) {
versi += "1" + "-";
} else {
versi += "0" + "-";
}
deleteCookie(i);
}
} else {
versi += "0" + "-";
}
}
setCookie('WiktPrefs', versi);
return;
}
/* Javascript to perform the CSS insertions */
if ( wiktGetPrefCookie('WiktionaryUseJSPreferences') == 'true' ) {
//Start by refreshing the cookies, deleting the old format cookies.
wiktSetPrefCookie('WiktionaryUseJSPreferences', 'true');
// CSS Insertions
document.write('<style>');
if ( wiktGetPrefCookie('WiktHideLogo') == 'true' ) document.write('#p-logo { display: none; }\n#column-one { padding-top: 0; } ');
//no button for this yet...
document.write('#bodyContent .allpagesredirect { text-decoration:line-through } \n');
document.write('</style>');
//Additional optional JavaScript insertions
if ( wiktGetPrefCookie('WiktionaryPreferencesTime') == 'true' ) document.write('<script '
+ 'type="text/javascript" src="/w/index.php?title=User:Connel_'
+ 'MacKenzie/clock.js&action=raw&ctype=text/javascript"><\/'
+ 'script>');
if ( wiktGetPrefCookie('WiktionaryPreferencesPopUps') == 'true' ) {
// [[w:User:Lupin/popups.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></'
+ 'script>');
document.write('<script '
+ 'type="text/javascript" src="/w/index.php?title=User:Connel_'
+ 'MacKenzie/mess-with-popups.js&action=raw&ctype=text/javascript"><\/'
+ 'script>');
} //end of popups
if ( wiktGetPrefCookie('WiktPrefPatrol') == 'true' ) document.write('<script '
+ 'type="text/javascript" src="/w/index.php?title=User:Connel_'
+ 'MacKenzie/patrolled.js&action=raw&ctype=text/javascript"><\/'
+ 'script>');
// 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 ( wiktGetPrefCookie(this.name) != 'true' ) {
wiktSetPrefCookie(this.name, 'true');
} else {
wiktSetPrefCookie(this.name, 'false');
}
}
if ( 'true' == wiktGetPrefCookie( cookieToToggle ) ) {
checkbox.checked = true ;
}
var isPreferencePage = document.getElementById('isPreferencePage');
isPreferencePage.appendChild( checkbox );
if ( 'true' == wiktGetPrefCookie( cookieToToggle ) ) {
checkbox.checked = true ;
}
var text = document.createTextNode( speedTip );
isPreferencePage.appendChild( text );
var text = document.createElement( 'br' );
isPreferencePage.appendChild( text );
return true;
}
function wiktAddSeparator(wiktSepText) {
var txtnod = document.createTextNode( wiktSepText );
var isPreferencePage = document.getElementById('isPreferencePage');
isPreferencePage.appendChild( txtnod );
txtnod = document.createElement( 'hr' );
isPreferencePage.appendChild( txtnod );
}
//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() {
wiktSetPrefCookie(this.name, this.value);
}
textbox.value = wiktGetPrefCookie( cookieToInput );
isPreferencePage.appendChild( textbox );
var text = document.createTextNode( speedTip );
isPreferencePage.appendChild( text );
return true;
}
/* </pre>
== CustomizePreferencesPage==
*Note that this needs to be re-written as a separate tab (or two or three) that appear when wgPageName=="Special:Preferences".
<pre> */
function CustomizePreferencesPage() {
//If on [[Special:Preferences]], add reminder link
var isWmPrefsPage = document.getElementById('wpReset');
if (isWmPrefsPage) {
var wiktlink = document.createElement("a");
wiktlink.setAttribut('href', '/wiki/Wiktionary:Preferences');
var wiktltxt = document.createTextNode("See also: Wiktionary-specific preferences");
wiktlink.appendChild( wiktltxt );
isWmPrefsPage.appendChild( wiktlink );
}
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)
// Hide the "noscript" div and display the "hasscript" one
var noscript = document.getElementById('wtprefs.noscript');
var hasscript = document.getElementById('wtprefs.hasscript');
if (noscript != null && hasscript != null) {
noscript.style.display = 'none';
hasscript.style.display = 'block';
}
// http://tools.wikimedia.de/~cmackenzie/make_buttons.html
// crop image to 21 pixels vertical, whatever horizontal.
//TODO: gray out all other choices if this is not yet checked!!!
wiktAddButton( 'WiktionaryUseJSPreferences', 'Χρήση των προτιμήσεων σε αυτή τη σελίδα');
wiktAddSeparator('>ΠΡΟΣΟΧΗ - Αν το παραπάνω κουτάκι δεν είναι τσεκαρισμένο, το κάθε τι στη σελίδα είναι απενεργοποιημένο');
// Andrew's clock
wiktAddButton( 'WiktionaryPreferencesTime', 'Display the local timezone date and time on top right corner of every page');
wiktAddButton( 'WiktionaryPreferencesTimeUTC', 'Display UTC date and time instead - You must check the above box for this to work');
// [[User:Lupin/popups.js]]
wiktAddButton( 'WiktionaryPreferencesPopUps', 'Use [[w:User:Lupin/popups.js]] - Originally for Wikipedia - now has Wiktionary-specific class overrides');
wiktAddButton( 'WiktHideLogo', 'Hide the logo in the upper left corner for more left-column buttons');
// If they have a "delete" button on ''this'' page, they are a sysop.
var isSysop = document.getElementById('ca-delete');
if ( !isSysop ) return;
wiktAddSeparator( 'Sysop-only functions: ');
wiktAddButton( 'WiktPrefPatrol', 'Patrolling enhancements - add a (mark) next to (diff) to mark as patrolled without leaving Special:RC. Use popups above, to hover over (diff) links, then click (mark).');
}
$( CustomizePreferencesPage );