DI Compare

try to take over the world!

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         DI Compare
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       menli
// @match        http://127.0.0.1:8080/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

function startUI(){
	var ui = "<table style='border:1px solid green; width:50%; margin-top:80px; margin-bottom:30px'><tr><td><button id='lmjcomp'>compare</button></td></tr></table>";
	var div = document.createElement("div");
	div.innerHTML = ui;
	document.body.insertBefore(div,document.body.firstChild);
}

function lmjSave(e){
	if(e.which == 83){
		//save here
		//mstrmojo-Table refine-table
		//tbody tr td div div refine-cell-text-container refine-cell-text
		var wrangdata = document.getElementsByClassName("refine-cell-text");
		var wrangeler = {};
		
		for(var item in wrangdata){
			wrangeler[item] =  wrangdata[item].innerText;
		}
		var wrangelerjson = JSON.stringify(wrangeler);
		window.localStorage.setItem("wrangler",wrangelerjson);
		alert("save success");
		
			
	}
}

function lmjComp(){
	//compare here
	var tmp = document.getElementsByTagName("tbody");
	var max = 0;
	var comp = tmp[tmp.length-1].getElementsByTagName("tr");
	var wrangler = JSON.parse(window.localStorage.getItem("wrangler"));
	var count = 0;

	for(var item in comp){
		if(item!=0){
			var tds = comp[item].getElementsByTagName("td");

			for(var td in tds){
				if(td<=tds.length-1){
					
					tds[td].style.backgroundColor = "yellow";

					if(tds[td].innerText == wrangler[count]){
						tds[td].style.backgroundColor = "green"; 
					}
					else{
						tds[td].style.backgroundColor = "red";
					console.log("%%%%unmatch%%%%%%%%%");
					console.log("preview:" + tds[td].innerText);
					console.log("document:" + wrangler[count]);
					console.log("*******************");
					}
					count++;
				}
					

			}
		}		
	}


	
}

function bindEvent(){
	document.body.addEventListener("keydown",lmjSave);
	document.getElementById("lmjcomp").addEventListener("click",lmjComp);
}

startUI();
bindEvent();













//**************
})();