Diferencia entre revisiones de «Usuario:Lmorillas/vector.js»

De WikiEducator
Saltar a: navegación, buscar
(cambio de orden)
 
(No se muestran 7 ediciones intermedias de 2 usuarios)
Línea 1: Línea 1:
// copied from User:JimTittsler/vector.js
+
// Basado en http://wikieducator.org/User:JimTittsler/vector.js
  
// importScript('http://wikieducator.org/User:JimTittsler/googlesearch.js');
+
importScript('Ususario:Lmorillas/googlesearch.js');
  
/* createGoogleSearch() */
+
// reader mode for narrow screens --> para el tablet de 7"
addOnloadHook(function () {
+
    var g = document.getElementById('searchform');
+
    var output = document.createElement('div');
+
    output.innerHTML = '<form action="http://wikieducator.org/WikiEducator:Google_Search" id="cse-search-box"><div><input type="hidden" name="cx" value="008846155551583468489:ekh9ssqol8q" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" id="gcse" size="31" style="width:12.2em; font-size:95%" /><input type="submit" class="searchButton" name="sa" value="Search" /></div></form><script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>';
+
    g.appendChild(output);
+
    if (skin == 'vector') {
+
        var p = document.getElementById('p-search');
+
        p.style.marginTop = '-1.5em';
+
        var s = document.styleSheets;
+
        for(i=s.length-1; i>=0; i--) {
+
            var rules = s[i].cssRules ? s[i].cssRules : s[i].rules;
+
            for(j=0; j<rules.length; j++) {
+
                if(rules[j].selectorText && rules[j].selectorText.toLowerCase().indexOf('#p-search form') != -1) {
+
                    rules[j].style.margin='0.25em 0 0';
+
                    i = 0;
+
                    break;
+
                }
+
            }
+
        }
+
    }
+
});
+
 
+
/* showGoogleResults() */
+
addOnloadHook(function () {
+
  if (wgPageName == "WikiEducator:Google_Search") {
+
    var g = document.getElementsByTagName("head")[0];
+
    var inlscript = document.createElement('script');
+
    inlscript.type = 'text/javascript';
+
    inlscript.innerHTML = 'var googleSearchIframeName = "cse-search-results";var googleSearchFormName = "cse-search-box";var googleSearchFrameWidth = 600;var googleSearchDomain = "www.google.com";var googleSearchPath = "/cse";';
+
    g.appendChild(inlscript);
+
    var resscript = document.createElement('script');
+
    resscript.type = 'text/javascript';
+
    resscript.src = "http://www.google.com/afsonline/show_afs_search.js";
+
    g.appendChild(resscript);
+
    g = document.getElementById('catlinks');
+
    if (g) {
+
      g.style.display = 'none';
+
    }
+
  }
+
});
+
 
+
// reader mode for narrow screens
+
 
// should follow googlesearch.js if used
 
// should follow googlesearch.js if used
 
// window.weReader = true;  // force to always use reader mode, regardless of width
 
// window.weReader = true;  // force to always use reader mode, regardless of width
 +
importScript('Usuario:Lmorillas/reader.js');
  
// importScript('http://wikieducator.org/User:JimTittsler/reader.js');
 
 
// read-mostly layout adjustments for vector skin to make left panel into slideout drawer
 
 
$(function () {
 
$(function () {
   var ppos = -164;
+
   $('#n-recentchanges').after('<li id="n-newpages"><a href="/Special:NewPages?namespace=all" title="The list of newly created pages">Páginas nuevas</a></li>');
  var pmenuheight = $(window).height()-15;
+
   // gardening tool
  var weReaderMode = false;
+
  if (wgPageName === 'Especial:PáginasNuevas') {
   function restyleSearch() { // FIXME custom search may not be loaded yet
+
     $.getScript('/extensions/WE/spam.js');
    $('#p-search').css('margin-bottom', '30px').css('margin-top', '30px');
+
     $('#searchInput, #gcse').css('width', '115px');
+
 
   }
 
   }
   function reader(){
+
   if (wgAction === 'history') {
    if (!weReaderMode && (window.weReader || ($(window).width() <= 1024))) {
+
    $.getScript('/extensions/WE/deleterevs.js');
      weReaderMode = true;
+
      $('#panel').css('position', 'fixed')
+
                .css('top', '2px')
+
                .css('left', ppos + 'px')
+
                .css('background', '#f3f3f3')
+
                .css('border-right', 'solid black')
+
                .css('border-bottom', 'solid black')
+
                .css('z-index', '10')
+
                .wrapInner('<div id="panelmenu" style="height: ' + pmenuheight + 'px; overflow: auto" />')
+
                .prepend('<div id="panelbutton" style="position: absolute; top: 0px; background:black; color:white; padding: 10px 8px 10px 172px; border-top-right-radius: 8px; border-bottom-right-radius: 8px;">WikiEducator</div>');
+
      $('#p-logo').hide();
+
      $('#content').css('margin-left', '0px');
+
      $('#p-search').insertBefore('#p-Navigation');
+
      restyleSearch();  setTimeout(restyleSearch, 2000); // FIXME
+
      $('#p-personal').insertAfter('#p-Navigation')
+
                      .addClass('portal')
+
                      .css('position', 'static')
+
                      .css('right', '0px')
+
                      .find('ul').wrap('<div class="body" />').end()
+
                      .find('h5').css('display', 'block').end()
+
                      .find('li').css('float', 'none');
+
      $('#left-navigation').css('top', '0px');
+
      $('#right-navigation').css('margin-top', '0px');
+
      $('#head-base').css('height', '40px');
+
      $('#socialbookmarks').css('padding-left', '0.5em');
+
      $('#panelbutton').click(function(e) {
+
        e.preventDefault();
+
        ppos = (ppos === 0) ? -164 : 0;
+
        $('#panel').animate( {left: ppos }, 'fast');
+
      });
+
    }
+
 
   }
 
   }
  $(window).resize(function() {
 
    reader();
 
    if (weReaderMode) {
 
      $('#panelmenu').css('height', $(window).height()-15 + 'px');
 
    }
 
  });
 
  reader();
 
 
});
 
});
 +
 +
/* hide-vector-sidebar.js: Adds a button to toggle visibility of the Vector sidebar.
 +
  Written by PleaseStand. Public domain; all copyright claims waived as described
 +
  in http://en.wikipedia.org/wiki/Template:PD-self */
 +
 +
/*global document, window, addOnloadHook, addPortletLink, skin*/
 +
 +
var sidebarSwitch;
 +
 +
function sidebarHide() {
 +
document.getElementById("mw-panel").style.visibility = "hidden";
 +
document.getElementById("mw-head-base").style.marginLeft = "0";
 +
document.getElementById("content").style.marginLeft = "0";
 +
document.getElementById("left-navigation").style.left = "0";
 +
document.getElementById("footer").style.marginLeft = "0";
 +
if(typeof sidebarSwitch == "object") {
 +
sidebarSwitch.parentNode.removeChild(sidebarSwitch);
 +
}
 +
sidebarSwitch = addPortletLink("p-cactions", "javascript:sidebarShow()", "Mostrar barra", "ca-sidebar", "Show the navigation links", "a");
 +
}
 +
 +
function sidebarShow() {
 +
document.getElementById("mw-head-base").style.marginLeft = "";
 +
document.getElementById("content").style.marginLeft = "";
 +
document.getElementById("left-navigation").style.left = "";
 +
document.getElementById("footer").style.marginLeft = "";
 +
document.getElementById("mw-panel").style.visibility = "";
 +
if(typeof sidebarSwitch == "object") {
 +
sidebarSwitch.parentNode.removeChild(sidebarSwitch);
 +
}
 +
sidebarSwitch = addPortletLink("p-cactions", "javascript:sidebarHide()", "Ocultar barra", "ca-sidebar", "Hide the navigation links", "a");
 +
}
 +
 +
// Only activate on Vector skin
 +
if(skin == "vector") {
 +
addOnloadHook(function() {
 +
// Change this if you want to show the sidebar by default
 +
sidebarShow();
 +
});
 +
}

Última revisión de 01:32 27 ene 2015

// Basado en http://wikieducator.org/User:JimTittsler/vector.js
 
importScript('Ususario:Lmorillas/googlesearch.js');
 
// reader mode for narrow screens  --> para el tablet de 7"
// should follow googlesearch.js if used
// window.weReader = true;  // force to always use reader mode, regardless of width
importScript('Usuario:Lmorillas/reader.js');
 
$(function () {
  $('#n-recentchanges').after('<li id="n-newpages"><a href="/Special:NewPages?namespace=all" title="The list of newly created pages">Páginas nuevas</a></li>');
  // gardening tool
  if (wgPageName === 'Especial:PáginasNuevas') {
    $.getScript('/extensions/WE/spam.js');
  }
  if (wgAction === 'history') {
    $.getScript('/extensions/WE/deleterevs.js');
  }
});
 
/* hide-vector-sidebar.js: Adds a button to toggle visibility of the Vector sidebar.
   Written by PleaseStand. Public domain; all copyright claims waived as described
   in http://en.wikipedia.org/wiki/Template:PD-self */
 
/*global document, window, addOnloadHook, addPortletLink, skin*/
 
var sidebarSwitch;
 
function sidebarHide() {
	document.getElementById("mw-panel").style.visibility = "hidden";
	document.getElementById("mw-head-base").style.marginLeft = "0";
	document.getElementById("content").style.marginLeft = "0";
	document.getElementById("left-navigation").style.left = "0";
	document.getElementById("footer").style.marginLeft = "0";
	if(typeof sidebarSwitch == "object") {
		sidebarSwitch.parentNode.removeChild(sidebarSwitch);
	}
	sidebarSwitch = addPortletLink("p-cactions", "javascript:sidebarShow()", "Mostrar barra", "ca-sidebar", "Show the navigation links", "a");
}
 
function sidebarShow() {
	document.getElementById("mw-head-base").style.marginLeft = "";
	document.getElementById("content").style.marginLeft = "";
	document.getElementById("left-navigation").style.left = "";
	document.getElementById("footer").style.marginLeft = "";
	document.getElementById("mw-panel").style.visibility = "";
	if(typeof sidebarSwitch == "object") {
		sidebarSwitch.parentNode.removeChild(sidebarSwitch);
	}
	sidebarSwitch = addPortletLink("p-cactions", "javascript:sidebarHide()", "Ocultar barra", "ca-sidebar", "Hide the navigation links", "a");
}
 
// Only activate on Vector skin
if(skin == "vector") {
	addOnloadHook(function() {
		// Change this if you want to show the sidebar by default
		sidebarShow();
	});
}