User:Kiokurashi/common.js: Difference between revisions

From IdleOn MMO Wiki
No edit summary
mNo edit summary
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
$(document).ready(function() {
// $(document).ready(function(){
    $.each($('.InputUsername'), function(){
// var element = document.createElement("p"); // "p" is the type of element that will be created
    var container = $(this);
// element.style = "color:blue"; // to modify attributes to the element that will be created, just type element.(attribute you want to modify) = "whatever value"
$($(this)).html('<span>Hello</span>');
// element.contentText = "Text Here"; // this sets the innerHTML of the element that will be created to "Paragraph text"
    });
// document.getElementById('firstHeading').appendChild(element); // this adds the element to the page content
// });
$(document).ready(function(){
var personalExtra = document.getElementById('personal-extra');
var pExtraUList = personalExtra.querySelector('ul');
var darkmodeElement = document.createElement('li');
var darkmodeLink = document.createElement('a');
var darkmodeIcon = document.createElement('img');
darkmodeLink.setAttribute('href', '#');
darkmodeLink.setAttribute('id', 'pt-darkmode-icon');
darkmodeLink.setAttribute('class', 'ext-darkmode-link');
darkmodeIcon.setAttribute('src','https://idleon.wiki/wiki/images/8/8d/Minuteglass.png');
darkmodeLink.appendChild(darkmodeIcon);
darkmodeElement.appendChild(darkmodeLink);
pExtraUList.appendChild(darkmodeElement);
});
});
/*
var a = document.createElement("a");
var ulist = document.getElementById("list1");
var newItem = document.createElement("li");


/* $(document).ready(function(){
a.textContent = "...ooo";
    $.each($('.bleh'), function(){
a.setAttribute('href', "http://www.msn.com");
    var container = $(this);
newItem.appendChild(a);
    var url = 'https://raw.githubusercontent.com/BigCoight/IdleonWikiBot3.0/master/builds/templates/Warrior_template.json';
ulist.appendChild(newItem);
    var x2 = parseFloat($(this).data('x2'));
 
    var max = parseFloat($(this).data('max'));
var el = document.createElement('img')
    var func1 = $(this).data('func1');
el.setAttribute('src','images/s2.jpg')
    var y1 = parseFloat($(this).data('y1'));
*/
    var y2 = parseFloat($(this).data('y2'));
    var func2 = $(this).data('func2');
    $('.result1', container).text(0);
    $('.result2', container).text(0);
    $('.valInput', this).html('(<input id="inField" type="number" min="0" max="'+max+'" placeholder=" Level "/>) ');
    $("#inField", this).change(function(){
    var inVal = parseInt($(this).val());
    $('.result1', container).text(lavaFunc(func1,inVal,x1,x2));
    $('.result2', container).text(lavaFunc(func2,inVal,y1,y2));
    });
    });
}); */

Latest revision as of 19:25, 11 June 2023

// $(document).ready(function(){
// 	var element = document.createElement("p"); // "p" is the type of element that will be created
// 	element.style = "color:blue"; // to modify attributes to the element that will be created, just type element.(attribute you want to modify) = "whatever value"
// 	element.contentText = "Text Here"; // this sets the innerHTML of the element that will be created to "Paragraph text"
// 	document.getElementById('firstHeading').appendChild(element); // this adds the element to the page content
// });
$(document).ready(function(){
	var personalExtra = document.getElementById('personal-extra');
	var pExtraUList = personalExtra.querySelector('ul');
	var darkmodeElement = document.createElement('li');
	var darkmodeLink = document.createElement('a');
	var darkmodeIcon = document.createElement('img');
	darkmodeLink.setAttribute('href', '#');
	darkmodeLink.setAttribute('id', 'pt-darkmode-icon');
	darkmodeLink.setAttribute('class', 'ext-darkmode-link');
	darkmodeIcon.setAttribute('src','https://idleon.wiki/wiki/images/8/8d/Minuteglass.png');
	
	darkmodeLink.appendChild(darkmodeIcon);
	darkmodeElement.appendChild(darkmodeLink);
	pExtraUList.appendChild(darkmodeElement);
});
/*
var a = document.createElement("a");
var ulist = document.getElementById("list1");
var newItem = document.createElement("li");

a.textContent = "...ooo";
a.setAttribute('href', "http://www.msn.com");
newItem.appendChild(a);
ulist.appendChild(newItem);

var el = document.createElement('img')
el.setAttribute('src','images/s2.jpg')
*/