MediaWiki:Upload.js: verschil tussen versies

Uit Wikikids
Naar navigatie springen Naar zoeken springen
(Eerst even opslaan...)
Regel 15: Regel 15:
 
var Uplo3 = ""
 
var Uplo3 = ""
 
var Uplintro = "<b>Dit is het uploadformulier voor nieuwe bestanden.</b> "
 
var Uplintro = "<b>Dit is het uploadformulier voor nieuwe bestanden.</b> "
var Uplfooter = "<span style=\"float:right;clear:both;font-size:small\">Meld bugs bij gebruiker Sumurai8</span>"
+
var Uplfooter = "<span style=\"float:right;clear:both;font-size:xsmall\">Meld bugs bij gebruiker Sumurai8</span>"
 
var UplInfo = new Array()
 
var UplInfo = new Array()
  
Regel 33: Regel 33:
 
}
 
}
  
 +
function UplSt1a() {
 +
  Uplo1.innerHTML = Uplintro + "Heb je dit bestand zelf gemaakt?<br/><br/><b>NEE</b><br/><br/><input type=\"input\" id=\"UplURL\" value=\"http://\" size=\"40\"></input><input type=\"button\" onclick=\"UplSt2(document.getElementById('UplURL').value)\" value=\"Dit bestand komt van deze URL\"><br/><input type=\"input\" id=\"UplSrc\" size=\"40\" value=\"Naam van boek/tijdschrift etc.\"></input><input type=\"button\" onclick=\"UplSt2('Kopie:'+document.getElementById('UplSrc').value)\" value=\"Dit bestand is een kopie van dit boek/tijdschrift etc.\">"+Uplfooter
 +
}
  
 
+
function UplSt2(t1) {
 +
  if(t1 == "Zelf") {
 +
    UplInfo['SRC']  = 'Eigen werk'
 +
    UplInfo['LINK'] = '-'
 +
  }
 +
  else if(t1.indexOf('kopie:') != -1) {
 +
    UplInfo['SRC']  = 'Kopie/Scan'
 +
    UplInfo['LINK'] = '\'\''+t1.substring(t1.indexOf(':'),t1.length)+'\'\''
 +
  }
 +
  else {
 +
    if(t1.indexOf('http://') != -1) {
 +
      //http:-prefix bestaat, maar de slashes zorgen voor problemen verderop...
 +
      t1 = t1.substring(7,t1.length)
 +
    }
 +
    if(t1.indexOf('upload.wikimedia.org/wikipedia/commons/') != -1) {
 +
      //Directe link naar plaatje... URL ombouwen dus...
 +
      t1 = 'commons.wikimedia.org/wiki/'+t1.substring(44,t1.length)
 +
    }
 +
    if(t1.indexOf('www.') == -1) {
 +
      UplInfo['SRC']  = '[http://'+t1.substring(0,t1.indexOf('/')+' '+t1.substring(0,t1.indexOf('/')+']'
 +
      UplInfo['LINK'] = 'http://'+t1
 +
    }
 +
    else {
 +
      UplInfo['SRC']  = '[http://'+t1.substring(0,t1.indexOf('/')+' '+t1.substring(t1.indexOf('.')+1,t1.indexOf('/'))+']'
 +
      UplInfo['LINK'] = 'http://'+t1
 +
    }
 +
  }
 +
}
 
//En dan nog als alles klaar is... opstarten!!!
 
//En dan nog als alles klaar is... opstarten!!!
 
if( document.location.href.indexOf('wpDestFile=') == -1 && document.location.href.indexOf('wpUseOldWay=1') == -1) {
 
if( document.location.href.indexOf('wpDestFile=') == -1 && document.location.href.indexOf('wpUseOldWay=1') == -1) {

Versie van 26 jun 2009 14:56

//<pre>
/**
 * UPLOADSCRIPT
 *
 * Script moet een eenvoudig stappenplan geven dat het formulier op één manier invult
 * Eventueel kan de oude manier worden gebruikt
 *
 * Vragen/bugs: Gebruiker Sumurai8
 *
**/

//Defenieer een aantal objecten hier:
var Uplo1 = ""
var Uplo2 = ""
var Uplo3 = ""
var Uplintro = "<b>Dit is het uploadformulier voor nieuwe bestanden.</b> "
var Uplfooter = "<span style=\"float:right;clear:both;font-size:xsmall\">Meld bugs bij gebruiker Sumurai8</span>"
var UplInfo = new Array()


function UplStart() {
  Uplo1 = document.getElementById('uploadtext')
  Uplo2 = document.getElementById('upload')
  Uplo3 = document.getElementById('mw-upload-permitted')
  Uplo3.style.display = "none"
  Uplo2.style.display = "none"
  Uplo1.innerHTML = Uplintro + "Je kunt nieuwe bestanden (geluidsbestanden, afbeeldingen, pdf-pagina\'s uploaden via de oude (standaard) weg, of het nieuwe uploadformulier gebruiken;<br/><br/><input type=\"button\" onclick=\"document.location=\'http://wikikids.wiki.kennisnet.nl/Speciaal:Uploaden?wpUseOldWay=1\';\" value=\"Gebruik het oude formulier\"><br/><input type=\"button\" onclick=\"UplSt1()\" value=\"NIET GEBRUIKEN -- WERKT NOG NIET\">" + Uplfooter
}

function UplSt1() {
  //Upload step 1
  Uplo1.innerHTML = Uplintro + "Heb je dit bestand zelf gemaakt?<br/><br/><input type=\"button\" onclick=\"UplSt2('Zelf')\" value=\"JA, ik heb dit bestand zelf gemaakt\"><br/><input type=\"button\" onclick=\"UplSt1a()\" value=\"NEE, ik heb dit bestand niet zelf gemaakt\">"+Uplfooter
}

function UplSt1a() {
  Uplo1.innerHTML = Uplintro + "Heb je dit bestand zelf gemaakt?<br/><br/><b>NEE</b><br/><br/><input type=\"input\" id=\"UplURL\" value=\"http://\" size=\"40\"></input><input type=\"button\" onclick=\"UplSt2(document.getElementById('UplURL').value)\" value=\"Dit bestand komt van deze URL\"><br/><input type=\"input\" id=\"UplSrc\" size=\"40\" value=\"Naam van boek/tijdschrift etc.\"></input><input type=\"button\" onclick=\"UplSt2('Kopie:'+document.getElementById('UplSrc').value)\" value=\"Dit bestand is een kopie van dit boek/tijdschrift etc.\">"+Uplfooter
}

function UplSt2(t1) {
  if(t1 == "Zelf") {
    UplInfo['SRC']  = 'Eigen werk'
    UplInfo['LINK'] = '-'
  }
  else if(t1.indexOf('kopie:') != -1) {
    UplInfo['SRC']  = 'Kopie/Scan'
    UplInfo['LINK'] = '\'\''+t1.substring(t1.indexOf(':'),t1.length)+'\'\''
  }
  else {
    if(t1.indexOf('http://') != -1) {
      //http:-prefix bestaat, maar de slashes zorgen voor problemen verderop...
      t1 = t1.substring(7,t1.length)
    }
    if(t1.indexOf('upload.wikimedia.org/wikipedia/commons/') != -1) {
      //Directe link naar plaatje... URL ombouwen dus...
      t1 = 'commons.wikimedia.org/wiki/'+t1.substring(44,t1.length)
    }
    if(t1.indexOf('www.') == -1) {
      UplInfo['SRC']  = '[http://'+t1.substring(0,t1.indexOf('/')+' '+t1.substring(0,t1.indexOf('/')+']'
      UplInfo['LINK'] = 'http://'+t1
    }
    else {
      UplInfo['SRC']  = '[http://'+t1.substring(0,t1.indexOf('/')+' '+t1.substring(t1.indexOf('.')+1,t1.indexOf('/'))+']'
      UplInfo['LINK'] = 'http://'+t1
    }
  }
}
//En dan nog als alles klaar is... opstarten!!!
if( document.location.href.indexOf('wpDestFile=') == -1 && document.location.href.indexOf('wpUseOldWay=1') == -1) {
  addOnloadHook(UplStart);
}
if( document.location.href.indexOf('wpUseOldWay=1') != -1) {
  addOnloadHook(function () {
    var o1 = document.getElementById('wpUploadDescription')
    o1.value = "{"+"{Afbeelding\n|Wat staat er precies op de afbeelding?=\n|Waar heb je de afbeelding vandaan?=\n|Schrijf de complete link van de vindplaats op=\n|Wie heeft de afbeelding gemaakt?=\n|Heb je toestemming om de afbeelding te uploaden?=Ja/nee\n|Welke licentie?=\n}}\n<"+"!-- Standaard uploadscript gebruikt --"+">"
  })
}

//</pre>
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=MediaWiki:Upload.js&oldid=98544"