MediaWiki:Skin/Kamelionary.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K (Sch*** ... naja, muss ich wohl mit nodes machen; das bastell' ich aber lieber zu hause, heute Nachmittag ...)
K (oh mann ... hätte nicht gedacht, dass das so kompliziert wird ...)
Zeile 2: Zeile 2:
 
{
 
{
 
changeLogoPath();
 
changeLogoPath();
/* insertFeedback(); */
+
insertFeedback();
 
};
 
};
  
 
function changeLogoPath()
 
function changeLogoPath()
 
{
 
{
 +
/* wiki später rausschmeißen! */
 
document.getElementById("p-logo").getElementsByTagName("a")[0].href = "/index.php/Kamelionary:Hauptseite";
 
document.getElementById("p-logo").getElementsByTagName("a")[0].href = "/index.php/Kamelionary:Hauptseite";
 
}
 
}
  
function insertFeedback()
+
function insertFeedback() /* ach du Sch*** ist das kompliziert ... aber .innerHTML macht doofes Zeug :-( */
 
{
 
{
document.getElementById("p-search").innerHTML = document.getElementById("p-search").innerHTML + '</div></div><div id="p-feedback" class="portlet"><h5><a href="/index.php/Dung">Rückmeldung</a></h5><div class="pBody">Dieser Eintrag ist</div><ul><li>total geil</li></ul></div>'
+
var feedbackdiv          = document.createElement("div");
 +
var divclass              = document.createAttribute("class");
 +
  divclass.nodeValue      = "portlet";
 +
var divid                = document.createAttribute("id");
 +
  divid.nodeValue        = "p-feedback";
 +
var feedbackheader        = document.createElement("h5");
 +
var feedbackheadera      = document.createElement("a");
 +
var headertext            = document.createTextNode("Rückmeldung");
 +
var feedbackbody          = document.createElement("div");
 +
var bodyclass            = document.createAttribute("class");
 +
  bodyclass.nodeValue    = "pBody";
 +
var feedbackp            = document.createElement("p");
 +
var pid                  = document.createAttribute("id");
 +
  pid.nodeValue          = "fb_text";
 +
var ptext                = document.createTextNode("Dieser Eintrag ist");
 +
var feedbackul            = document.createElement("ul");
 +
var ulid                  = document.createAttribute("id");
 +
  ulid.nodeValue          = "fb_list";
 +
var feedbacklist          = new Array("obertittenaffengeil", "total GaGA", "das beste, was ich je gelesen habe", "nobelpreisverdächtig", "lololol");
 +
var discussionp          = document.createElement("p");
 +
var discussionpid        = document.createAttribute("id");
 +
  discussionpid.nodeValue = "fb_comment";
 +
var discussiona          = document.createElement("a");
 +
var discussionatext      = document.createTextNode("Eintrag kommentieren?");
 +
var discussionhref        = document.getElementById("ca-talk").getElementsByTagName("a")[0].href;
 +
feedbackdiv.setAttributeNode(divclass);
 +
feedbackdiv.setAttributeNode(divid);
 +
feedbackdiv.appendChild(feedbackheader);
 +
  feedbackheader.appendChild(feedbackheadera);
 +
    feedbackheadera.appendChild(headertext);
 +
feedbackdiv.appendChild(feedbackbody);
 +
  feedbackbody.setAttributeNode(bodyclass);
 +
    feedbackbody.appendChild(feedbackp);
 +
              feedbackp.setAttributeNode(pid);
 +
      feedbackp.appendChild(ptext);
 +
    feedbackbody.appendChild(feedbackul);
 +
              feedbackul.setAttributeNode(ulid);
 +
        discussionp.setAttributeNode(discussionpid);
 +
          discussionp.appendChild(discussiona);
 +
            discussiona.appendChild(discussionatext);
 +
document.getElementById("column-one").insertBefore(feedbackdiv, document.getElementById("p-tb"));
 +
for (var i = 0; i < feedbacklist.length; i++)
 +
{
 +
var feedbackli  = document.createElement("li");
 +
var feedbacklia = document.createElement("a");
 +
document.getElementById("fb_list").appendChild(feedbackli);
 +
document.getElementById("fb_list").getElementsByTagName("li")[i].appendChild(feedbacklia);
 +
document.getElementById("fb_list").getElementsByTagName("a")[i].appendChild(document.createTextNode(feedbacklist[i]));
 +
document.getElementById("fb_list").getElementsByTagName("a")[i].href = "javascript:feedback('" + feedbacklist[i] + "')";
 +
}
 +
document.getElementById("p-feedback").getElementsByTagName("a")[0].href = "/index.php/Dung";
 +
document.getElementById("p-feedback").getElementsByTagName("div")[0].appendChild(discussionp);
 +
document.getElementById("fb_comment").getElementsByTagName("a")[0].href = discussionhref;
 +
}
 +
 
 +
function feedback(feedbacktext)
 +
{
 +
Check = confirm("Diesen Eintrag als " + feedbacktext + " melden?");
 +
if (Check == true)
 +
{
 +
document.getElementById("fb_list").style.display = "none";
 +
document.getElementById("p-feedback").getElementsByTagName("div")[0].innerHTML = '<p id="fb-thanks"><a href="/index.php/Kamelopedia:Danke">Vielen Dank!</a></p><p id="fb_comment">' + document.getElementById("fb_comment").innerHTML + '</p>';
 +
}
 
}
 
}

Version vom 24. April 2009, 19:56 Uhr

window.onload = function ()
	{
	changeLogoPath();
	insertFeedback();
	};

function changeLogoPath()
	{
	/* wiki später rausschmeißen! */
	document.getElementById("p-logo").getElementsByTagName("a")[0].href = "/index.php/Kamelionary:Hauptseite";
	}

function insertFeedback() /* ach du Sch*** ist das kompliziert ... aber .innerHTML macht doofes Zeug :-( */
	{
	var feedbackdiv           = document.createElement("div");
	var divclass              = document.createAttribute("class");
	  divclass.nodeValue      = "portlet";
	var divid                 = document.createAttribute("id");
	  divid.nodeValue         = "p-feedback";
	var feedbackheader        = document.createElement("h5");
	var feedbackheadera       = document.createElement("a");
	var headertext            = document.createTextNode("Rückmeldung");
	var feedbackbody          = document.createElement("div");
	var bodyclass             = document.createAttribute("class");
	  bodyclass.nodeValue     = "pBody";
	var feedbackp             = document.createElement("p");
	var pid                   = document.createAttribute("id");
	  pid.nodeValue           = "fb_text";
	var ptext                 = document.createTextNode("Dieser Eintrag ist");
	var feedbackul            = document.createElement("ul");
	var ulid                  = document.createAttribute("id");
	  ulid.nodeValue          = "fb_list";
	var feedbacklist          = new Array("obertittenaffengeil", "total GaGA", "das beste, was ich je gelesen habe", "nobelpreisverdächtig", "lololol");
	var discussionp           = document.createElement("p");
	var discussionpid         = document.createAttribute("id");
	  discussionpid.nodeValue = "fb_comment";
	var discussiona           = document.createElement("a");
	var discussionatext       = document.createTextNode("Eintrag kommentieren?");
	var discussionhref        = document.getElementById("ca-talk").getElementsByTagName("a")[0].href;
	feedbackdiv.setAttributeNode(divclass);
	feedbackdiv.setAttributeNode(divid);
	feedbackdiv.appendChild(feedbackheader);
	  feedbackheader.appendChild(feedbackheadera);
	    feedbackheadera.appendChild(headertext);
	feedbackdiv.appendChild(feedbackbody);
	  feedbackbody.setAttributeNode(bodyclass);
	    feedbackbody.appendChild(feedbackp);
              feedbackp.setAttributeNode(pid);
	      feedbackp.appendChild(ptext);
	    feedbackbody.appendChild(feedbackul);
              feedbackul.setAttributeNode(ulid);
        discussionp.setAttributeNode(discussionpid);
          discussionp.appendChild(discussiona);
            discussiona.appendChild(discussionatext);
	document.getElementById("column-one").insertBefore(feedbackdiv, document.getElementById("p-tb"));
	for (var i = 0; i < feedbacklist.length; i++)
		{
		var feedbackli  = document.createElement("li");
		var feedbacklia = document.createElement("a");
		document.getElementById("fb_list").appendChild(feedbackli);
		document.getElementById("fb_list").getElementsByTagName("li")[i].appendChild(feedbacklia);
		document.getElementById("fb_list").getElementsByTagName("a")[i].appendChild(document.createTextNode(feedbacklist[i]));
		document.getElementById("fb_list").getElementsByTagName("a")[i].href = "javascript:feedback('" + feedbacklist[i] + "')";
		}
	document.getElementById("p-feedback").getElementsByTagName("a")[0].href = "/index.php/Dung";
	document.getElementById("p-feedback").getElementsByTagName("div")[0].appendChild(discussionp);
	document.getElementById("fb_comment").getElementsByTagName("a")[0].href = discussionhref;
	}

function feedback(feedbacktext)
	{
	Check = confirm("Diesen Eintrag als " + feedbacktext + " melden?");
	if (Check == true)
		{
		document.getElementById("fb_list").style.display = "none";
		document.getElementById("p-feedback").getElementsByTagName("div")[0].innerHTML = '<p id="fb-thanks"><a href="/index.php/Kamelopedia:Danke">Vielen Dank!</a></p><p id="fb_comment">' + document.getElementById("fb_comment").innerHTML + '</p>';
		}
	}