webspace hosting reseller hosting|             | blog| forum| dating| free hosting| openhost| report abuse
Internet Fax To Email - Unlimited

Unlimited Faxes, No Fees, Dedicated Phone Number

Free Website Templates
Table of Contents

Code of Anti-Paranoia Firefox Extension

Project site - This here is the code section.

How to get to the source

How to repack the source

... after doing something with the code ...

The Files

This is quite the Hello world-extension ;-)

antiparanoiaOverlay.js

function dontPanic() {
	var icon = "chrome://antiparanoia/skin/antiparanoiam.png";
	var url = null;
	var title = "Don't Panic";
	var texts = new Array(6);
	texts[0] = "Stay calm.";
	texts[1] = "Everything is good.";
	texts[2] = "No one is against you.";
	texts[3] = "The world is a good place.";
	texts[4] = "Nobody is watching you.";
	texts[5] = "Everything will be much better soon.";
        texts[6] = "It isn't your fault.";
	
	var text = texts[ Math.round(Math.random()*(texts.length-1)) ];
	
	var preferences = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
	var mybranch = preferences.getDefaultBranch("antiparanoia.");
	
	var timeMinimal = mybranch.getIntPref("minimaltime");
	var timeRandomMax = mybranch.getIntPref("randommax");
	
	if(timeMinimal<60000) timeMinimal = 60000;
	if(timeRandomMax<0) timeMinimal = 0;
	var timeoutTilNext = Math.round(Math.random()*timeRandomMax) + timeMinimal;
	
	var alerts = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService);
	alerts.showAlertNotification(icon, title, text, false, null, null);
	setTimeout("dontPanic()",timeoutTilNext);
}

Questions? Ideas?