Kamel:J*/Ka-Mel-Oh/Testgelände/Notizzettel: Unterschied zwischen den Versionen
J* (Diskussion | Beiträge) Die Seite wurde neu angelegt. |
K Textersetzung - „http://kamelopedia.mormo.org/“ durch „http://kamelopedia.net/“ |
||
| (8 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
/ | __NOTOC__ | ||
__NEWSECTIONLINK__ | |||
==Framework: Array.prototype und Async== | |||
ab jetzt im Verzeichnis [[Kamel:J*/lib|lib]] zu finden! | |||
==Klassenarchitektur der Karten== | |||
<!-- | |||
function X () | |||
{ | |||
this.constructor(1,2,3,4) | |||
} | |||
X.prototype = new Card() | |||
function add(a,b,c,d) | |||
{ | |||
a = new Function( "this.constructor(" + | |||
parseInt(a) + "," + | |||
parseInt(b) + "," + | |||
parseInt(c) + "," + | |||
parseInt(d) + ")" | |||
); | |||
a.prototype = new Card(); | |||
return a; | |||
} | |||
fkt1 = add(1,2,3,4); | |||
fkt2 = add(2,7,8,9); | |||
fkt2.prototype.hooks.bla = | |||
c = new fkt2(); | |||
c instanceof fkt2 | |||
--> | |||
== Wiki-Klasse == | |||
Achtung, wichtig: Umstellen auf api.php und JSON: | |||
http://kamelopedia.net/api.php?format=jsonfm&indexpageids&action=query&prop=revisions&titles=Hauptseite&rvprop=ids|flags|timestamp|user|content|comment | |||
... und dann den Timestamp zum Schreiben benutzen (vorher .replace(/[^0-9]/g, "")!) | |||
Aktuelle version läuft aber schon im lib-Verzeichnis. | |||
== UI == | |||
if ( | <!-- | ||
dragger = { | |||
item: null, | |||
const: {pickupPrecision: 10, dropPrecision: 30}, | |||
object: { | |||
original: {x: NaN, y: NaN}, | |||
current: {x: NaN, y:NaN} | |||
}, | |||
pointer: { | |||
original: {x: NaN, y:NaN}, | |||
current: {x: NaN, y:NaN} | |||
}, | |||
handler: { klick: null, drag: null, drop: null }, | |||
dropzones: [ ], | |||
pickup: function (e) { | |||
if (dragger.item != null) | |||
return; | |||
dragger.object.original.x = this.offsetLeft; | |||
dragger.object.original.y = this.offsetTop; | |||
dragger.pointer.original.x = dragger.pointer.current.x; | |||
dragger.pointer.original.y = dragger.pointer.current.y; | |||
dragger.item=this; | |||
return false; | |||
}, | |||
mouseMove: function (e) { | |||
dragger.pointer.current.x = document.all ? window.event.clientX : e.pageX; | |||
dragger.pointer.current.y = document.all ? window.event.clientY : e.pageY; | |||
if (dragger.item != null) | |||
{ | { | ||
dragger.drag(); | |||
} | } | ||
if ( | }, | ||
drag: function () { | |||
dragger.object.current.y = dragger.object.original.y + dragger.pointer.current.y - dragger.pointer.original.y; | |||
dragger.object.current.x = dragger.object.original.x + dragger.pointer.current.x - dragger.pointer.original.x; | |||
dragger.item.style.top = dragger.object.current.y + "px"; | |||
dragger.item.style.left = dragger.object.current.x + "px"; | |||
}, | |||
drop: function () { | |||
if ( Math.abs(dragger.object.original.x - dragger.object.current.x) < dragger.const.pickupPrecision && | |||
Math.abs(dragger.object.original.y - dragger.object.current.y) < dragger.const.pickupPrecision ) | |||
{ | { | ||
dragger.item.style.top = dragger.object.original.y + "px"; | |||
dragger.item.style.left = dragger.object.original.x + "px"; | |||
var d = dragger.item; | |||
dragger.item = null; | |||
if ( dragger.handler.klick != null ) | |||
dragger.handler.klick( d ) | |||
} | } | ||
} | dragger.item = null; | ||
} | |||
} | |||
document.onmousemove = dragger.mouseMove; | |||
document.onmouseup = dragger.drop; | |||
for(c=0;c<(l=document.getElementsByClassName("handcard").length);c++) | |||
{ | |||
document.getElementsByClassName("handcard")[c].onmousedown = dragger.pickup; | |||
} | } | ||
--> | |||
== Hat nix mit Ka-Mel-Oh zu tun, aber weils so schön ist == | |||
// | <!-- | ||
//document.getElementById("bodyContent").innerHTML += "<iframe id='bw'></iframe>"; | |||
//document.getElementById("bw").style.width="100%" | |||
//document.getElementById("bw").style.height="400px" | |||
//document.getElementById("bw").style.border="1px transparent solid" | |||
var histTitle= "Hauptseite"; | |||
var histRevQuery="{{#dpl: titlematch=Hauptseite|skipthispage=no|namespace=|firstrevisionsince=20040101|format=,%REVISION%}}" | |||
hist = new Async( [ | |||
function( | function () { return { wiki: {source: histRevQuery, title: histTitle}}; }, | ||
wiki.parse, | |||
function (e) { a = (parseInt("0"+e.wiki.HTML.replace(/[^0-9]/g,""))); document.getElementById("bw").href=wgServer+wgScript+"/" } | |||
]) | |||
] | |||
hist.start(); | |||
--> | |||
Aktuelle Version vom 3. Januar 2014, 02:43 Uhr
Framework: Array.prototype und Async
ab jetzt im Verzeichnis lib zu finden!
Klassenarchitektur der Karten
Wiki-Klasse
Achtung, wichtig: Umstellen auf api.php und JSON:
http://kamelopedia.net/api.php?format=jsonfm&indexpageids&action=query&prop=revisions&titles=Hauptseite&rvprop=ids%7Cflags%7Ctimestamp%7Cuser%7Ccontent%7Ccomment
... und dann den Timestamp zum Schreiben benutzen (vorher .replace(/[^0-9]/g, "")!)
Aktuelle version läuft aber schon im lib-Verzeichnis.