Usuario:Spacebirdy/custom.js

De Wikcionario, el diccionario libre

Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.

  • Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
  • Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
  • Internet Explorer/Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
  • Opera: Presiona Ctrl+F5.
 // von [[:en:User:Connel MacKenzie/custom.js]]
/* <pre><noinclude> */

/*</pre>
__TOC__
== Javascript to perform the CSS insertions ==
<pre> */

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');
    } //end of popups

 if ( $.cookie('WiktionaryPreferencesKeyPad') == 'true' ) importScript('Usuario: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', 'Utilizar las preferencias de esta página');

  wiktAddButton( 'WiktionaryPreferencesHideSiteNotice', 'Esconder mensaje del sitio');

  //TODO: Add color selections for all box-things.

  // [[User:Lupin/popups.js]]
  wiktAddButton( 'WiktionaryPreferencesPopUps', 'Utiliza [[w:User:Lupin/popups.js]]');

  //See [[MediaWiki:Monobook.js]]
  wiktAddButton( 'WiktionaryPreferencesHideNav', 'Esconder TODAS las traducciones (y secciones similares) - están abiertos por defecto');
 
  //See [[MediaWiki:Monobook.js]]
  wiktAddButton( 'WiktionaryPreferencesShowNav', 'Mostrar TODAS las traducciones (y secciones similares) - están abiertos por defecto');
 
  // Allow special characters in [Search] input
  wiktAddButton( 'WiktionaryPreferencesKeyPad', 'Permite insertar carácteres especiales en la busqueda');

  //Disable the javascript redirect between pages that differ only in case.
  wiktAddButton( 'WiktionaryDisableAutoRedirect', 'Desactivar la auto-redirección.');
}

jQuery(document).ready( CustomizePreferencesPage );

/* </pre> */