...

View Full Version : Hiding my javascript source



DieAntwoord`
06-10-2010, 08:14 PM
I want to hide my JavaScript but when I checked the FAQ of this forum, I saw that it said that it isn't possible.

But how did worldometers.info did it? Because I cant find the JavaScript source.

jmrker
06-10-2010, 08:23 PM
Checkout some of these sites for an explanation:
http://www.google.com/search?q=eval+unescape+javascript&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Rowsdower!
06-10-2010, 08:39 PM
It's not impervious. It will only stop the casual viewer...

For example, the source from worldometers.info:

<script language="JavaScript" src="engine-en96540109.js" type="text/javascript"></script><script type="text/javascript">
//(c) Copyright Worldometers.info. All rights reserved.

function startClock() {
timeRemaining();
}

function round_number(number,dec_places){
//(c) Copyright 2008, Russell Walker, Netshine Software Limited. www.netshinesoftware.com
var new_number='';var i=0;number=number.toString();dec_places=dec_places*1;dec_point_pos=number.lastIndexOf(".");if(dec_point_pos==0){number="0"+number;dec_point_pos=1}if(dec_point_pos==-1||dec_point_pos==number.length-1){if(dec_places>0){new_number=number+".";for(i=0;i<dec_places;i++){new_number+="0"}return new_number}else{return number}}var existing_places=(number.length-1)-dec_point_pos;if(existing_places==dec_places){return number}if(existing_places<dec_places){new_number=number;for(i=existing_places;i<dec_places;i++){new_number+="0"}return new_number}var end_pos=(dec_point_pos*1)+dec_places;var round_up=false;if((number.charAt(end_pos+1)*1)>4){round_up=true}var digit_array=new Array();for(i=0;i<=end_pos;i++){digit_array[i]=number.charAt(i)}for(i=digit_array.length-1;i>=0;i--){if(digit_array[i]=="."){continue}if(round_up){digit_array[i]++;if(digit_array[i]<10){break}}else{break}}for(i=0;i<=end_pos;i++){if(digit_array[i]=="."||digit_array[i]<10){new_number+=digit_array[i]}else{new_number+="0"}}if(dec_places==0){new_number=new_number.replace(".","")}return new_number}

function string(number) {
var tempnum;

tempnum= Math.round(number)+" ";
tempnum= tempnum.substring(0,tempnum.length-1);

if (tempnum.length >3) {
tempnum = tempnum.substring(0,tempnum.length-3) + "," + tempnum.substring(tempnum.length-3, 99);
}
if (tempnum.length >7) {
tempnum = tempnum.substring(0,tempnum.length-7) + "," + tempnum.substring(tempnum.length-7, 99);
}
if (tempnum.length >11) {
tempnum = tempnum.substring(0,tempnum.length-11) + "," + tempnum.substring(tempnum.length-11, 99);
}
if (tempnum.length >15) {
tempnum = tempnum.substring(0,tempnum.length-15) + "," + tempnum.substring(tempnum.length-15, 99);
}
if (tempnum.length == 11) {
tempnum = " " + tempnum;
}
if (tempnum.length == 10) {
tempnum = " " + tempnum;
}
if (tempnum.length == 9) {
tempnum = " " + tempnum;
}
if (tempnum.length == 7) {
tempnum = " " + tempnum;
}
if (tempnum.length == 6) {
tempnum = " " + tempnum;
}
if (tempnum.length == 5) {
tempnum = " " + tempnum;
}
if (tempnum.length == 3) {
tempnum = " " + tempnum;
}
if (tempnum.length == 2) {
tempnum = " " + tempnum;
}
if (tempnum.length == 1) {
tempnum = " " + tempnum;
}
return tempnum;
}

function timeRemaining() {

var now = new Date();
var newyears = new Date("January 1, 2000");
var todaysdate = new Date("January 1, 2000");
var may4 = new Date("May 4, 1999");
var ye = new Date("Dec 31, 2009");

var currentPop;
var BirthsInYear;

newyears.setFullYear(now.getFullYear());

secsSince = Math.round(now.getTime() - newyears.getTime())/1000;
secsSincePop = Math.round(now.getTime() - may4.getTime())/1000;
secsSinceYearEnd = Math.round(now.getTime() - ye.getTime())/1000;

todaysdate.setMonth(now.getMonth());
todaysdate.setDate(now.getDate());
todaysdate.setFullYear(now.getFullYear());
secsToday = (now.getTime()-todaysdate.getTime())/1000;


// test to see what page is loaded, then activate the appropriate worldometers
// NOTE: if you startup more than 20, they go to slow

switch (document.title) {
case 'Worldometers - real time world statistics':
{


// population
current_population = string( Math.round( (secsSincePop) * 2.48573 + 5979540016 - (secsToday) * 2.48573) + Math.round((secsToday) * 4.41461) - Math.round((secsToday) * 1.92888) ) ;
births_this_year = string(Math.round( (secsSince) * 4.41461 - (secsToday) * 4.41461) + (secsToday) * 4.41461);
births_today = string((secsToday) * 4.41461);
dth1s_this_year = string(Math.round( (secsSince) * 1.92888 - (secsToday) * 1.92888) + (secsToday) * 1.92888);
dth1s_today = string((secsToday) * 1.92888);
absolute_growth = string( Math.round((secsToday) * 4.41461) - Math.round((secsToday) * 1.92888) );

document.worldometers.elements["current_population"].value = current_population;
document.worldometers.elements["births_this_year"].value = births_this_year;
document.worldometers.elements["births_today"].value = births_today;
document.worldometers.elements["dth1s_this_year"].value = dth1s_this_year;
document.worldometers.elements["dth1s_today"].value = dth1s_today;
document.worldometers.elements["absolute_growth"].value = absolute_growth;

// govt & econ
gov_expenditures_health = string((secsToday) * 100791);
gov_expenditures_education = string((secsToday) * 78940);
gov_expenditures_military = string((secsToday) * 43730);
countries_un = string((secsSince) / (secsSince) * 192);
automobile_produced_this_year = string((secsSince) * 1.648);
bicycle_produced_this_year = string((secsSince) * 3.46);
computers_sold_this_year = string((secsSince) * 9.069);

document.worldometers.elements["gov_expenditures_health"].value = gov_expenditures_health;
document.worldometers.elements["gov_expenditures_education"].value = gov_expenditures_education;
document.worldometers.elements["gov_expenditures_military"].value = gov_expenditures_military;
document.worldometers.elements["countries_un"].value = countries_un;
document.worldometers.elements["automobile_produced_this_year"].value = automobile_produced_this_year;
document.worldometers.elements["bicycle_produced_this_year"].value = bicycle_produced_this_year;
document.worldometers.elements["computers_sold_this_year"].value = computers_sold_this_year;

// society & media
books_published = string((secsSince) * .03186);
newspapers_circulated = string((secsToday) * 6317);
tv = string((secsToday) * 6.64);
cellular = string((secsToday) * 39.32);
videogames = string((secsToday) * 1401);
internet_users = string(secsSinceYearEnd * 8 + 1801171917);
em = string((secsToday) * 3289352);
blog_posts = string((secsToday) * 7);
google_searches = string((secsToday) * 35112);

document.worldometers.elements["books_published"].value = books_published;
document.worldometers.elements["newspapers_circulated"].value = newspapers_circulated;
document.worldometers.elements["tv"].value = tv;
document.worldometers.elements["cellular"].value = cellular;
document.worldometers.elements["videogames"].value = videogames;
document.worldometers.elements["internet_users"].value = internet_users;
document.worldometers.elements["em"].value = em;
document.worldometers.elements["blog_posts"].value = blog_posts;
document.worldometers.elements["google_searches"].value = google_searches;



// environment
forest_loss = string((secsSince) * .3571);
soil_erosion = string((secsSince) * .1903);
co2_emissions = string((secsSince) * 708);
temperature = round_number(14.55 + (secsSince * .0230/31536000),9);
desert_land_formed = string((secsSince) * .47);
ext = string((secsSince) * .0044);
tox_chem = string((secsSince) * .3105);
earth_travel = string((secsSince) * 18.5 * 1.61);


document.worldometers.elements["forest_loss"].value = forest_loss;
document.worldometers.elements["soil_erosion"].value = soil_erosion;
document.worldometers.elements["co2_emissions"].value = co2_emissions;
document.worldometers.elements["temperature"].value = temperature;
document.worldometers.elements["desert_land_formed"].value = desert_land_formed;
document.worldometers.elements["ext"].value = ext;
document.worldometers.elements["tox_chem"].value = tox_chem;
document.worldometers.elements["earth_travel"].value = earth_travel;


// food
food_production = string((secsSince) * 166.47);
undernourished = string(secsSincePop * .3171 + 914000000);
overweight = string(secsSincePop * .43 + 1000000000);
obese = string(secsSincePop * .121 + 300000000);
obesity_spending = string((secsToday) * 2917.3);
dth1_hunger = string((secsToday) * 0.33);
spending_on_weight_loss = string((secsToday) * 1268.4);

document.worldometers.elements["food_production"].value = food_production;
document.worldometers.elements["undernourished"].value = undernourished;
document.worldometers.elements["overweight"].value = overweight;
document.worldometers.elements["obese"].value = obese;
document.worldometers.elements["dth1_hunger"].value = dth1_hunger;
document.worldometers.elements["obesity_spending"].value = obesity_spending;
document.worldometers.elements["spending_on_weight_loss"].value = spending_on_weight_loss;

// water
water_consumed = string((secsSince) * .133);
water_disax = string((secsSince) * 0.16);
nowater_population = string(secsSince * 5.28 + 1300370016);


document.worldometers.elements["water_consumed"].value = water_consumed;
document.worldometers.elements["water_disax"].value = water_disax;
document.worldometers.elements["nowater_population"].value = nowater_population;

// energy

energy_used = string((secsToday) * 4928.58);
energy_nonren = string((secsToday) * 4544.00);
energy_ren = string((secsToday) * 374.57);
solar_energy = string((secsToday) * 465594.88);
oil_consumption = string((secsToday) * 972.22);
oil_reserves = string(secsSince * -972.22 + 1317000000000);
oil_days = string((secsSince * -972 + 1317000000000)/84000000);
gas_reserves = string(secsSince * -219.91 + 1161000000000);
gas_days = string((secsSince * -219.91 + 1161000000000)/19000000);
coal_reserves = string(secsSince * -335.65 + 4416000000000);
coal_days = string((secsSince * -335.65 + 4416000000000)/29000000);


document.worldometers.elements["energy_used"].value = energy_used;
document.worldometers.elements["energy_nonren"].value = energy_nonren;
document.worldometers.elements["energy_ren"].value = energy_ren;
document.worldometers.elements["solar_energy"].value = solar_energy;
document.worldometers.elements["oil_consumption"].value = oil_consumption;
document.worldometers.elements["oil_reserves"].value = oil_reserves;
document.worldometers.elements["oil_days"].value = oil_days;
document.worldometers.elements["gas_reserves"].value = gas_reserves;
document.worldometers.elements["gas_days"].value = gas_days;
document.worldometers.elements["coal_reserves"].value = coal_reserves;
document.worldometers.elements["coal_days"].value = coal_days;


// health
dth1s_communicable_disaxs = string((secsSince) * .4281);
dth1s_children = string((secsSince) * .35);
ab = string((secsSince) * 1.46);
abi = string((secsSince) * .04);
dth1s_maternal = string((secsSince) * .02);
infections_hiv = string((secsSince * .1)+30000000);
dth1s_ads = string((secsSince * .0647));
dth1s_cancer = string((secsSince) * .2410);
dth1s_malarial = string((secsSince) * .032);
cigarettes_smoked = string((secsToday) * 175514);
dth1s_cigarettes = string((secsSince) * .2125);
dth1s_alchool = string((secsSince) * .0571);
sui = string((secsSince) * .0340);
drug_spending = string((secsSince) * 12684);
dth1s_cars = string((secsSince) * .0403);


document.worldometers.elements["dth1s_communicable_disaxs"].value = dth1s_communicable_disaxs;
document.worldometers.elements["dth1s_children"].value = dth1s_children;
document.worldometers.elements["ab"].value = ab;
document.worldometers.elements["abi"].value = abi;
document.worldometers.elements["dth1s_maternal"].value = dth1s_maternal;
document.worldometers.elements["infections_hiv"].value = infections_hiv;
document.worldometers.elements["dth1s_ads"].value = dth1s_ads;
document.worldometers.elements["dth1s_cancer"].value = dth1s_cancer;
document.worldometers.elements["dth1s_malarial"].value = dth1s_malarial;
document.worldometers.elements["cigarettes_smoked"].value = cigarettes_smoked;
document.worldometers.elements["dth1s_cigarettes"].value = dth1s_cigarettes;
document.worldometers.elements["dth1s_alchool"].value = dth1s_alchool;
document.worldometers.elements["sui"].value = sui;
document.worldometers.elements["drug_spending"].value = drug_spending;
document.worldometers.elements["dth1s_cars"].value = dth1s_cars;



break;
}
}

timerID = setTimeout("timeRemaining()", 1);
timerRunning = true;

}
</script>

You can try the method here, if you like:
http://www.webtoolkit.info/javascript-base64.html

Or just go here and let the website do it for you:
http://www.intelliwebtools.com/node/169

DieAntwoord`
06-10-2010, 09:33 PM
Ok nice. But i got a question now.

1. How did you get the source ? I mean did u decode or something? And how did u do that.

jmrker
06-10-2010, 10:37 PM
Ok nice. But i got a question now.

1. How did you get the source ? I mean did u decode or something? And how did u do that.

Did you read the end of the last post?

Old Pedant
06-11-2010, 07:28 AM
It's no wonder worldometers.info hides their source. They must be embarrassed that they use such crappy code and don't want the world to know it. <snicker />

rnd me
06-12-2010, 03:07 AM
the best way to hide it is to keep it on your local machine.
the same origin policy prevents other users from seeing code on your own computer.
it can still be found, that why i hide mine under the mattress when i go on vacation.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum