Aiuto:Chrome Shortcut manager

Da Wikisource.

L'estensione Shortcut manager per Chrome è un potente strumento che permette di creare scorciatoie da tastiera: è dunque possibile associare alcune azioni a combinazioni di tasti, anche per Wikisource.


Screenshots
Immagine della pagina base di edit di nuove hotkeys personali
  1. Pulsante di apertura della maschera di edit.
  2. Punto di inserimento della combinazione di tasti (non inserire i caratteri a mano, ma premere effettivamente la combinazione che si vuole definire)
  3. URL su cui devono agire quelle combinazioni. Per Wikisource, usare
    • */it.wikisource.org/wiki/* per qualsiasi pagina
    • */it.wikisource.org/w/* per qualsiasi pagina in modifica1.
  4. lista di istruzioni in Javascript che verranno eseguite con la combinazione di tasti; una volta salvata la pagina, sarà immediatamente attivata.

Combinazioni[modifica]

Puoi utilizzare le seguenti combinazioni, e, se ne crei altre, per favore aggiungile qui in basso. Ovviamente, puoi cambiare utilizzare le combinazioni di tasti che preferisci, le seguenti sono solo degli esempi. Per importare il codice selezionare le funzioni e utilizzare la funzione Import di Shortcut manager.

// ==UserScript==
// @ShortcutManager
// @name Saves SAL 75% after acrepl()
// @namespace h1Hv6IfIxhvW
// @key Alt+3
// @include *it.wikisource.org/w/*
// ==/UserScript==
acrepl();
$("input[type=radio][value=3]").click();
$("#wpSave").click();



// ==UserScript==
// @ShortcutManager
// @name Saves page with a SAL 50%
// @namespace h1Hv6IfIxhvW
// @key Alt+2
// @include *it.wikisource.org/w/*
// ==/UserScript==
$("input[type=radio][value=2]").click();
$("#wpSave").click();



// ==UserScript==
// @ShortcutManager
// @name Vita dei Campi & Ziba  specific edits
// @namespace h1Hv6IfIxhvW
// @key Alt+5
// @include *it.wikisource.org/w/*
// ==/UserScript==
testo=leggiBox();
if (wgTitle.indexOf("Vita dei campi")>-1) {
   testo=testo.replace(/- /g,"― ")
   .replace(/é/g,"è");
    scriviBox(testo);
    newRi();
}
if (wgTitle.indexOf("Zibaldone")>-1) {
   testo=testo.replace(/ ec /g," ec. ")
   .replace(/’é/g,"’è")
   .replace(/’é/g,"’è")
   .replace(/Firenze\./g,"Firenze,")
   .replace(/Pisa\./g,"Pisa,")
   .replace(/ agos[to]*\./gi," agosto")
   .replace(/ luglio\./gi," luglio")
   .replace(/Bull\. de Féruss\./g,"''Bulletin'' de Férussac,")
   .replace(/\(Fir\./g,"Firenze,")
   .replace(/(§)\.(\d.)\./g,"$1 $2,")
   .replace(/Crus\./g,"Crusca")
   .replace(/ott\./gi,"ottobre")
   .replace(/dic\./gi,"dicembre")
   .replace(/mar\./gi,"marzo")
   .replace(/mag\./gi,"maggio")
   .replace(/apr\./gi,"aprile")
   .replace(/feb\./gi,"febbraio");
    scriviBox(testo);
    acrepl();
}

// ==UserScript==
// @ShortcutManager
// @name Corregge la J in θ nella selezione
// @namespace h1Hv6IfIxhvW
// @key Ctrl+Alt+j
// @include *it.wikisource.org/w/*
// ==/UserScript==
theta();



// ==UserScript==
// @ShortcutManager
// @name deep postOCR
// @namespace h1Hv6IfIxhvW
// @key Alt+6
// @include *wikisource.org/w/*
// ==/UserScript==
rimuoviPrimaRiga();
x=leggiBox(); 
g=find_stringa(x,"\n\n\n","\n\n\n",1); 
x=x.replace(g,"").trim(); 
scriviBox(x);
newRi();
cleanup();



// ==UserScript==
// @ShortcutManager
// @name Shortcut for empty pages
// @namespace h1Hv6IfIxhvW
// @key Alt+0
// @include *it.wikisource.org/w/*
// ==/UserScript==
scriviBox("{{RigaIntestazione|||}}","0");
scriviBox("");
$("input[type=radio][value=0]").click();
$("#wpSave").click();



// ==UserScript==
// @ShortcutManager
// @name replace common mistakes saved in cor
// @namespace h1Hv6IfIxhvW
// @key Alt+1
// @include *it.wikisource.org/w/*
// ==/UserScript==
for (i in cor) {regexRepl(i,cor[i]);}




// ==UserScript==
// @ShortcutManager
// @name Edit page key
// @namespace h1Hv6IfIxhvW
// @key Alt+c
// @include *it.wikisource.org/wiki/*
// ==/UserScript==
window.location=$("#ca-edit a").attr("href");

// ==UserScript==
// @ShortcutManager
// @name Saves SAL 100% after acrepl()
// @namespace h1Hv6IfIxhvW
// @key Alt+4
// @include *it.wikisource.org/w/*
// ==/UserScript==
acrepl();
$("input[type=radio][value=4]").click();
$("#wpSave").click();



// ==UserScript==
// @ShortcutManager
// @name Applica il tl|Var su un testo selezionato
// @namespace h1Hv6IfIxhvW
// @key Alt+8
// @include */w/*
// ==/UserScript==
t=selection();
t[1]=t[1].split("\n");
for (i=0;i<t[1].length;i+=1) {
   t[1][i]=$.trim(t[1][i]);
   if (t[1][i].length>1) {
      t[1][i]="{{Annotazione a lato|"+t[1][i]+"}}";
      }
   }
t[1]=t[1].join("\n");
scriviBox(t.join(""));

// ==UserScript==
// @ShortcutManager
// @name Aggiunge un tl|Var
// @namespace h1Hv6IfIxhvW
// @key Alt+7
// @include */w/*
// ==/UserScript==
t=selection();
t[1]="{{Var|"+t[1]+"|"+t[1]+"}}";
scriviBox(t.join(""));

// ==UserScript==
// @ShortcutManager
// @name Premi Salva dopo Enter in spanForm
// @namespace h1Hv6IfIxhvW
// @key Alt+Enter
// @include */w/*
// ==/UserScript==
if (document.activeElement.id=="spanForm") $("#spanForm").next().click();

// ==UserScript==
// @ShortcutManager
// @name Carica jquery in forum politico
// @namespace uA6OOWZEmzLQ
// @key Alt+j
// @include *www.forum-politico.org*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
// ==/UserScript==
$.noConflict();
jQuery("table[id^='ignored']").remove();
jQuery("a[id='tid_5353']").parents("tr").remove();
jQuery("a[id='tid_5376']").parents("tr").remove();

// ==UserScript==
// @ShortcutManager
// @name view OCR from Talk page
// @namespace h1Hv6IfIxhvW
// @key Alt+o
// @include *
// ==/UserScript==
var ocr=$.ajax({url:"http://it.wikisource.org/w/index.php?action=raw&title=Discussioni pagina:"+wgTitle,async:false}).responseText;
$("#showboxContent")
   .css("overflow","auto")
   .css("height","130px")
   .css("position","absolute")
   .css("width","100%")
   .append(ocr);

$("#showbox").css("height","150px").css("display","block");

testoOld=find_stringa(leggiBox(),"<poem>","</poem>",0);
testo=testoOld.split("\n");
for (i=0; i<testo.length;i+=1) {testo[i]=testo[i].substring(0,1).toLocaleUpperCase()+testo[i].substring(1);}
testo=testo.join("\n");
scriviBox(leggiBox().replace(testoOld,testo)
    .replace(/«/g,"“")
    .replace(/»/g,"„")
    .replace(/í/g,"ì")
    .replace("<!--fine-->",""));
if (testo.indexOf("{{Centrato")==-1)  {testo=testo.replace("<poem>","{{Centrato|"+$("#ca-ns0_0 a").attr("title").replace("Pagina transclusa in Sonetti romaneschi/I/","").toLocaleUpperCase()+"}}\n\n<poem>");}


// ==UserScript==
// @ShortcutManager
// @name attiva intoolbar (preliminare)
// @namespace h1Hv6IfIxhvW
// @key Alt+Shift+9
// @include */w/*
// ==/UserScript==
scegliCarattere=function (span){sel=selection();sel[1]=$(span).text();scriviBox(sel.join(""));$("#intoolbar").remove();}

h='<div id="intoolbar" style="position:fixed;top:0; left:0; border:2px solid red; z-index:2000; background-color:white;" ondoubleclick="$(this).remove()"><p></p></div>'
$(h).appendTo($("#content"));

variants={"a":"aÁÂÀÄÃAÅÆáàâäãaåæ","o":"oÓÒÔÖŒØóòǿôöõœø","e":"eÉÈèÊêËëẼẽĘęĘ́ę́ĚěĖė","i":"iÍíÌìÎîÏïĨĩĮįĮ́į́İı","u":"uÚúÙùÛûÜüǗǘǛǜǙǚǕǖŲųŲ́ų́","α":"αὰάᾶᾳᾲᾴᾷἀἂἄἆἁἃἅἇᾀᾂᾄᾆᾁᾃᾅᾇΆἈἊἌἎἉἋἍἏ"};
t=variants[selection()[1]].split("");
tt="";for(i=0;i<t.length;i+=1){tt+="<span>"+t[i]+"</span> ";}
$("#intoolbar p").append($(tt));
$("#intoolbar span").attr("onclick","scegliCarattere(this)");

// ==UserScript==
// @ShortcutManager
// @name converte una vocale selezionata in vocale+~
// @namespace h1Hv6IfIxhvW
// @key Alt+9
// @include */w/*
// ==/UserScript==
sel=selection(); 
selc=sel[1];
switch(selc) {
case "a":
  sel[1]="ã";
  break;
case "u":
  sel[1]="ũ";
  break;
case "o":
  sel[1]="õ";
  break;
case "e":
  sel[1]="ẽ";
  break;
case "i":
  sel[1]="ĩ";
  break;
}
scriviBox(sel.join(""));

// ==UserScript==
// @ShortcutManager
// @name inserisce il template RigaIndice/Belli sul testo grezzo
// @namespace h1Hv6IfIxhvW
// @key Alt+b
// @include */w/*
// ==/UserScript==
var t=leggiBox();
t=t.replace("Pag.","„");
t=t.replace(/(\d+\.) +([^„\n]+) +(„) +(\d+)/g,"{{RigaIndice/Belli|$1|$2|$3|$4|312}}").replace(/\<poem\>/g,"").replace(/\<\/poem\>/g,"");
t=t.replace("„","{{Pt|Pag.|„}}");
scriviBox(t);
scriviBox(leggiBox(0)+'\n<table width="100%" cellspacing="0">',0);

// ==UserScript==
// @ShortcutManager
// @name newSections
// @namespace uA6OOWZEmzLQ
// @key Ctrl+Shift+s
// @include *it.wikisource.org/w/*
// ==/UserScript==
function sel() {
    var elemento=document.activeElement;
	var ss=elemento.selectionStart;
	var se=elemento.selectionEnd;
	var contenuto=elemento.value;
	var s=[contenuto.substring(0,ss),contenuto.substring(ss,se),contenuto.substring(se)];
	return [elemento, s];
}
 
function incaps(pre,post) {
    var s=sel();
    var testo=s[1][0]+pre+s[1][1]+post+s[1][2];
    s[0].value=testo;
} 

function newSections() {
    var s=sel();
    if (s[1][2].indexOf("<section end=s2 />")==-1) {
        s[1][0]="<section begin=s1 />"+s[1][0]+"<section end=s1 />";
        s[1][2]="<section begin=s2 />"+s[1][2]+"<section end=s2 />"; 
    }
    else {
        s[1][0]=s[1][0]+"<section end=s2 />";
        s[1][2]="<section begin=s3 />"+s[1][2].replace("<section end=s2 />","<section end=s3 />");    
    }
    s[0].value=s[1][0]+s[1][1]+s[1][2];
    return;
}


// ==UserScript==
// @ShortcutManager
// @name Conversione f - > s 
// @namespace 7qDw2j91JGcP
// @key Ctrl+Alt+f
// @include *wikisource.org*
// ==/UserScript==
scriviBox(leggiBox().replace(/f/g,"s"))

newSections();

Note

  1. Si possono definire anche url più specifici, fino a livello di singole opere o pagine di una singola opera