Skip to content

Instantly share code, notes, and snippets.

@DCzajkowski
Created January 19, 2017 18:23
Show Gist options
  • Save DCzajkowski/8583cf7b51a322871fd9ccfdbaaf81a5 to your computer and use it in GitHub Desktop.
Save DCzajkowski/8583cf7b51a322871fd9ccfdbaaf81a5 to your computer and use it in GitHub Desktop.
Program do danych w CEIDG
/* Skompilowany program */
javascript:(function()%7Bfunction%20copyThat(text)%20%7Bvar%20node%20%3D%20document.createElement('textarea')%3Bvar%20selection%20%3D%20document.getSelection()%3Bnode.textContent%20%3D%20text%3Bdocument.body.appendChild(node)%3Bselection.removeAllRanges()%3Bnode.select()%3Bdocument.execCommand('copy')%3Bselection.removeAllRanges()%3Bdocument.body.removeChild(node)%3B%7Dif(document.title%3D%3D%22CEIDG%22)%20%7Blet%20tdane%20%3D%20document.querySelectorAll('.search-data-label')%3Blet%20twart%20%3D%20document.querySelectorAll('.search-data-value')%3Bvar%20output%20%3D%20'CEIDG%3B'%3Bvar%20x%20%3D%200%3Bvar%20dane%20%3D%20''%3Bwhile%20(x%3C10)%20%7Bdane%20%3D%20tdane%5Bx%5D.innerText.trim()%3Bwart%20%3D%20twart%5Bx%5D.innerText.trim()%3Btdane%5Bx%5D.style.backgroundColor%20%3D%20%22red%22%3Btwart%5Bx%5D.style.backgroundColor%20%3D%20%22red%22%3Boutput%20%2B%3D%20wart%20%2B%20'%3B'%3Bx%2B%2B%3B%7DcopyThat(output)%3B%7Dif(document.title%3D%3D%22E-MS-Portal%20%7C%20Dane%20podmiotu%22)%20%7Blet%20tdane%20%3D%20document.querySelectorAll('.big')%3Bvar%20output%20%3D%20'KRS%3B'%3Bvar%20x%20%3D%200%3Bvar%20dane%20%3D%20''%3Bwhile%20(x%3C17)%20%7Bdane%20%3D%20tdane%5Bx%5D.innerText.trim()%3Btdane%5Bx%5D.style.backgroundColor%20%3D%20%22red%22%3Boutput%20%2B%3D%20dane%20%2B%20'%3B'%3Bx%2B%2B%3B%7DcopyThat(output)%3B%7D%7D)()
/* Pełny program */
function copyThat(text) {
var node = document.createElement('textarea');
var selection = document.getSelection();
node.textContent = text;
document.body.appendChild(node);
selection.removeAllRanges();
node.select();
document.execCommand('copy');
selection.removeAllRanges();
document.body.removeChild(node);
}
if(document.title=="CEIDG") {
let tdane = document.querySelectorAll('.search-data-label');
let twart = document.querySelectorAll('.search-data-value');
var output = 'CEIDG;';
var x = 0;
var dane = '';
while (x<10) {
dane = tdane[x].innerText.trim();
wart = twart[x].innerText.trim();
tdane[x].style.backgroundColor = "red";
twart[x].style.backgroundColor = "red";
output += wart + ';';
x++;
}
copyThat(output);
}
if(document.title=="E-MS-Portal | Dane podmiotu") {
let tdane = document.querySelectorAll('.big');
var output = 'KRS;';
var x = 0;
var dane = '';
while (x<17) {
dane = tdane[x].innerText.trim();
tdane[x].style.backgroundColor = "red";
output += dane + ';';
x++;
}
copyThat(output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment