User:Kiokurashi/common.js: Difference between revisions

From IdleOn MMO Wiki
imported>Kiokurashi
No edit summary
mNo edit summary
 
(46 intermediate revisions by 2 users not shown)
Line 1: Line 1:
// $(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(){
$(document).ready(function(){
    $.each($('.stampDiv'), function(){
var personalExtra = document.getElementById('personal-extra');
    var container = $(this);
var pExtraUList = personalExtra.querySelector('ul');
    var x1 = parseFloat($(this).data('x1'));
var darkmodeElement = document.createElement('li');
    var x2 = parseFloat($(this).data('x2'));
var darkmodeLink = document.createElement('a');
    var func = $(this).data('func');
var darkmodeIcon = document.createElement('img');
    var i4 = parseFloat($(this).data('i4'));
darkmodeLink.setAttribute('href', '#');
    var i6 = parseFloat($(this).data('i6'));
darkmodeLink.setAttribute('id', 'pt-darkmode-icon');
    var i7 = parseFloat($(this).data('i7'));
darkmodeLink.setAttribute('class', 'ext-darkmode-link');
    var i8 = parseFloat($(this).data('i8'));
darkmodeIcon.setAttribute('src','https://idleon.wiki/wiki/images/8/8d/Minuteglass.png');
    var i9 = parseFloat($(this).data('i9'));
    var offset = parseInt($(this).data('offset'));
darkmodeLink.appendChild(darkmodeIcon);
    $('.resultB', container).text(0);
darkmodeElement.appendChild(darkmodeLink);
    $('.resultC', container).text(0);
pExtraUList.appendChild(darkmodeElement);
    $('.resultM', container).text(0);
    $('.valInput', this).html('<input id="inField" type="number" min="0" placeholder=" Level " style="max-width: 100px;"/>');
    $("#inField", this).change(function(){
    var inVal = parseInt($(this).val());
    var goldCost = i8 * Math.pow(i9 - (inVal / (inVal + 5 * i4)) * 0.25, inVal * (10 / i4));
var materialCost = i6 * Math.pow(i7, Math.pow(Math.round(inVal / i4) - 1, 0.8));
    $('.resultB', container).text(lavaFunc(func,inVal,x1,x2));
    $('.resultC', container).html(coindisplay(Math.floor(goldCost)));
    if (inVal % i4 == offset){
    $('.resultM', container).text("(" + offset + ")" + Math.floor(materialCost).toLocaleString());
    } else {
    $('.resultM', container).text("(" + offset + ")" + i4 - (inVal % i4) + " Upgrades left before you need to increase max level.");
    }
    });
    });
});
});
/*
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')
*/

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')
*/