Benutzer:Fritzbox/VM/tm w2t infobox raumfahrer.js
aus Wikipedia, der freien Enzyklopädie
Hinweis: Leere nach dem Speichern den Browser-Cache, um die Änderungen zu sehen: Mozilla/Firefox: Shift-Strg-R, Internet Explorer: Strg-F5, Opera: F5, Safari: ⌘-R (bzw. Strg-R), Konqueror: Strg-R.
/** * Wiki2Template-Plugin des Vorlagen-Meister fuer die Vorlage "Infobox Raumfahrer", Version: 0.1beta, Date: 2007-02-04 * Copyright (C) 2007 [[Benutzer:Revvar]] * Released under the GPL license version 2 * http://www.gnu.org/copyleft/gpl.html * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. * See the GNU General Public License for more details. */ function TM_P_Infobox_Raumfahrer() { var self = this; TM_P_Wiki2Template.call(this); var name = "Infobox Raumfahrer"; this.opGetName = function() {return name;}; var template = "Infobox Raumfahrer"; this.opGetTemplate = function() {return template;}; var super_opTransform = this.opTransform; this.opTransform = function(wiki_text) { wiki_text = super_opTransform(wiki_text); var Template = new Object(); Template["template_name"] = template; Template["source"] = "plug-in"; var line = wiki_text.split("\n"); var entry = new Array(); for(var c = 0;c<=2;c++) { //erstellen der Einträge for (var a = 0; a < line.length; a++) if ((line[a].search(/\s*(\|-|\|\}|\{\|)/) != 0) && (line[a].search(/\|\|/) > 0)) { var entryprov = line[i].split("||"); var d = c*2; var e = e++; entry[d] = entryprov[0]; entry[e] = entryprov[1]; } } for(var i = 0; i<=3; i++){ //Parameter wird bestimmt switch (i) { case 1: var m = "Land:"; break; case 2: var m = "Datum Auswahl:"; break; case 2: var m = "Anzahl Raumflüge:"; break; } for(var k = 0; k<=2; k+2){ //Es wird nach dem bestimmten Parameter gesucht if (entry[k] == m) { var l = k + 1; Template["tm_form_"+entry[k]] = entry[l]; } } } } return Template; } } TM_P_Infobox_Raumfahrer.prototype=new TM_P_Wiki2Template(); TM_PluginList.push(new TM_P_Infobox_Raumfahrer()); // register plugin