E |
|
Linio 1: |
Linio 1: |
| /* Ĉiu ajn JavaScriptaĵo ĉi tie estos ŝarĝita por ĉiu uzanto sur ĉiu paĝo. | | /* Ĉiu ajn JavaScriptaĵo ĉi tie estos ŝarĝita por ĉiu uzanto sur ĉiu paĝo. |
| | | |
- | == Ĝeneralaj funkcioj ==
| + | */ |
- | | + | |
- | <pre><nowiki>
| + | |
- | * Ĝeneralaj funkcioj por lanĉi funkciojn aŭ skriptojn.
| + | |
- | */
| + | |
- | | + | |
- | /**
| + | |
- | * Instalado de nova funkcio ĉi maniere :
| + | |
- | * addOnloadHook(nomo_de_la_funkcio); (sen parentezoj)
| + | |
- | * La sekva proceduro ne plus uzendas
| + | |
- | */
| + | |
- | if (!window.aOnloadFunctions) {
| + | |
- | var aOnloadFunctions = new Array();
| + | |
- | }
| + | |
- | | + | |
- | window.onload = function()
| + | |
- | {
| + | |
- | if (window.aOnloadFunctions) {
| + | |
- | for (var _i=0; _i<aOnloadFunctions.length; _i++) {
| + | |
- | aOnloadFunctions[_i]();
| + | |
- | }
| + | |
- | }
| + | |
- | }
| + | |
- | | + | |
- | function addLoadEvent(func) {
| + | |
- | hookEvent('load', func);
| + | |
- | }
| + | |
- | | + | |
- | /**
| + | |
- | * insertAfter : enmeti eron en paĝon
| + | |
- | */
| + | |
- | function insertAfter(parent, node, referenceNode) {
| + | |
- | parent.insertBefore(node, referenceNode.nextSibling);
| + | |
- | }
| + | |
- | | + | |
- | /**
| + | |
- | * Enmeti javaskripton de aparta apĝo ideo de Mickachu
| + | |
- | */
| + | |
- | function loadJs(page)
| + | |
- | {
| + | |
- | document.write('<script type="text/javascript" src="' +
| + | |
- | 'http://fr.wikipedia.org/w/index.php?title=' + page +
| + | |
- | '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
| + | |
- | }
| + | |
- | | + | |
- | /**
| + | |
- | * Projekto JavaScript
| + | |
- | */
| + | |
- | function obtenir(name)
| + | |
- | {
| + | |
- | loadJs('MediaWiki:JSScripts/' + name);
| + | |
- | }
| + | |
- | | + | |
- | /* Fino de la ĝeneralaj funkcioj </nowiki></pre>
| + | |
- | | + | |
- | == Serĉiloj ==
| + | |
- | | + | |
- | * Plibonigo de la serĉpaĝo v3
| + | |
- | * Aŭtoro : Marc Mongenet
| + | |
- | * Sub permesilo GFDL & GPL
| + | |
- | <pre><nowiki> */
| + | |
- | | + | |
- | function SpecialSearchEnhanced3()
| + | |
- | {
| + | |
- | | + | |
- | function SearchForm(search_action_url, engine_url, engine_name, logo_url,
| + | |
- | search_field_name, search_field_value, site_field_name, site_field_value)
| + | |
- | {
| + | |
- | var span = document.createElement("div");
| + | |
- | span.style.marginRight = "1em";
| + | |
- | span.style.width="100%";
| + | |
- | span.style.whiteSpace = "nowrap";
| + | |
- | | + | |
- | var form = document.createElement("form");
| + | |
- | form.method = "get";
| + | |
- | form.action = search_action_url;
| + | |
- | form.style.display = "inline";
| + | |
- | span.appendChild(form);
| + | |
- | | + | |
- | var input = document.createElement("input");
| + | |
- | input.type = "hidden";
| + | |
- | input.name = search_field_name;
| + | |
- | form.appendChild(input);
| + | |
- | | + | |
- | var site = document.createElement("input");
| + | |
- | site.type = "hidden";
| + | |
- | site.name = site_field_name;
| + | |
- | site.value = site_field_value;
| + | |
- | form.appendChild(site);
| + | |
- | | + | |
- | var submit = document.createElement("input");
| + | |
- | submit.type = "submit";
| + | |
- | submit.value = "Recherche";
| + | |
- | form.appendChild(submit);
| + | |
- | | + | |
- | form.onsubmit = function() {
| + | |
- | input.value = document.getElementById("lsearchbox").value;
| + | |
- | }
| + | |
- | | + | |
- | var a = document.createElement("a");
| + | |
- | a.href = engine_url;
| + | |
- | span.appendChild(a);
| + | |
- | | + | |
- | var img = document.createElement("img");
| + | |
- | img.src = logo_url;
| + | |
- | img.alt = engine_name;
| + | |
- | img.style.borderWidth = "0";
| + | |
- | img.style.padding = "5px";
| + | |
- | a.appendChild(img);
| + | |
- | | + | |
- | return span;
| + | |
- | }
| + | |
- | | + | |
- | if (typeof SpecialSearchEnhanced3Disabled != 'undefined') return;
| + | |
- | if (wgPageName != "Special:Search") return;
| + | |
- | | + | |
- | var mainNode = document.getElementsByTagName("form");
| + | |
- | if (!mainNode) return;
| + | |
- | mainNode = mainNode[0];
| + | |
- | mainNode.appendChild(document.createElement("center"));
| + | |
- | mainNode = mainNode.lastChild;
| + | |
- | | + | |
- | var searchValue = document.getElementById("lsearchbox").value;
| + | |
- | var engine;
| + | |
- | engine = SearchForm("http://partner.exalead.fr/search", "http://www.exalead.fr/", "Exalead",
| + | |
- | "http://www.wikipedia.fr/exalead.gif", "q", searchValue,
| + | |
- | "site", "eo.wikipedia.org");
| + | |
- | mainNode.appendChild(engine);
| + | |
- | engine = SearchForm("http://www.google.fr/search", "http://www.google.fr/", "Google",
| + | |
- | "http://www.google.com/logos/Logo_25wht.gif", "q", searchValue,
| + | |
- | "as_sitesearch", "eo.wikipedia.org");
| + | |
- | mainNode.appendChild(engine);
| + | |
- | engine = SearchForm("http://www.wikipediasearch.net/index.php", "http://www.wikipediasearch.net", "Wikipedia Search",
| + | |
- | "http://www.wikipediasearch.net/logo_mini.png", "action", searchValue,
| + | |
- | "lang", "eo");
| + | |
- | mainNode.appendChild(engine);
| + | |
- | engine = SearchForm("http://search.live.com/results.aspx", "http://search.live.com/", "Live",
| + | |
- | "http://search.live.com/s/affillogoLive.gif", "q", searchValue,
| + | |
- | "q1", "site:http://eo.wikipedia.org");
| + | |
- | mainNode.appendChild(engine);
| + | |
- | engine = SearchForm("http://fr.search.yahoo.com/search", "http://fr.search.yahoo.com/", "Yahoo!",
| + | |
- | "http://us.yimg.com/i/yahootogo/y88red2.gif", "p", searchValue,
| + | |
- | "vs", "eo.wikipedia.org");
| + | |
- | mainNode.appendChild(engine);
| + | |
- | }
| + | |
- | addOnloadHook(SpecialSearchEnhanced3);
| + | |
- | /* Fino de la serĉpaĝo */</nowiki></pre>
| + | |