Example #1
0
	onMessage: function(message) {
		switch(message.action) {
			case "pin":
				widget.panel.postMessage(message);
			break;
			case "register":
				if(panelVisible) {
					widget.panel.postMessage(message);
				} else {
					notifications.notify({
						title: "DroidGiro",
						text: "Redo att skanna",
						iconURL: self.data.url("images/icon.png")
					});
				}
			break;
			case "invoice":
				var found = bankWorker.postMessage(message.data);

				if(found < 1) {
					notifications.notify({
						title: "OCR",
						text: message.data.reference
					});
				}
			break;
			default:
				console.log('worker: ' + JSON.stringify(message));
			break;
		}
	}
Example #2
0
 onComplete: function(response){
    if(response.status == 200) {
       notifications.notify({
          text: "Le flux " + simpleStorage.storage.feed + " a correctement été mis à jour",
          iconURL: data.url("icon.png")
       });
    } else {
       //console.error("Sending request ERROR : " + response.status);
       notifications.notify({
          text: "Un problème s'est produit lors de la mise à jour du flux  " + simpleStorage.storage.feed,
          iconURL: data.url("icon.png")
       });
    }
 }
      worker.port.on("nowPlaying", function (msg) {
        musicPlaying = true;
        songsQueued = true;
        wgPlayPauseSong.content = '<img src="'+data.url('ui/icons/control-pause.png') +
                             '" style="cursor:pointer;"/>';
        wgPlayPauseSong.tooltip = "Pause Song";

        wgDisplaySong.port.emit("nowPlaying", msg);

        let albumArtURL = msg.song.artPath + 'm' +
                ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');

        let albumThumbURL = msg.song.artPath + 't' +
                ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');

        panelAlbumArt.port.emit("album", albumArtURL);

        //If the user enabled notifications display it
        if(msg.notify && simpleStorage.settings['notifications']) {
          notifications.notify({
            title: msg.song.ArtistName,
            text: msg.song.SongName,
            iconURL: albumThumbURL
          });
        }
      });
Example #4
0
exports.onUnload = function (reason) {
  
  if (reason == 'uninstall' || reason == 'disable') {

  var prev_locale;
  var prev_accept;
  var prev_match;

  prev_locale = prefsBundle.get(extbase+".localeprev", defaultlang);
  prev_accept = prefsBundle.get(extbase+".acceptprev", defaultlangstr);
  prev_match = prefsBundle.get(extbase+".matchprev", defaultmatchOS);

  prefsBundle.set("general.useragent.locale", prev_locale);
  prefsBundle.set("intl.accept_languages", prev_accept);
  prefsBundle.set("intl.locale.matchOS", prev_match);
  
  prefsBundle.set(extbase+".localeprev", "");
  prefsBundle.set(extbase+".acceptprev", "");
  prefsBundle.set(extbase+".matchprev", false);
  prefsBundle.set(extbase+".first", 0);

  var notifications = require("notifications");
  var iconpopup = localdata.url("icon32.png");
    
  notifications.notify({
    text: "Reinicieu el navegador per tornar a la configuració prèvia al Valencianitzador...",
    iconURL: iconpopup
  });

  }  

};
Example #5
0
 notify: function(title, text) {
   notifications.notify({
    title: main.name + " - " + title,
    text: text,
    iconURL: main.icon
   });
 },
Example #6
0
 simpleStorage.on("OverQuota", function () {
   notifications.notify({
     title: 'Storage space exceeded',
     text: 'Removing recent annotations'});
   while (simpleStorage.quotaUsage > 1)
     simpleStorage.storage.annotations.pop();
 });
Example #7
0
		put.onsuccess=function(){
		notifications.notify({
          title: "Divel Notepad",
		  text: "Note added successfully",
		  iconURL: data.url("save64.png")
		});
		}
Example #8
0
		del.onsuccess=function(){
		notifications.notify({
			title: "Divel Notepad",
			text: "Note deleted successfully",
			iconURL: data.url("open64.png")
		});
		}
Example #9
0
/** @brief  Add a new annotation to our annotations store
 *  @param  text    The annotation text;
 *  @param  anchor  Anchor information [ url, ancestorId, anchorText ];
 */
function addAnnotation(text, anchor)
{
    /*
    console.log("Add a new annotation: ",
                    "anchor.url[", anchor[0], "], ",
                    "anchor.ancestorId[", anchor[1], "], ",
                    "anchor.anchorText[", anchor[2] ,"], ",
                    "text[", text, "]");
    // */

    var annotation  = new Annotation(text, anchor);
    simpleStorage.storage.annotations.push(annotation);

    notifyMatchers();


    var count   = simpleStorage.storage.annotations.length,
        text    = 'There '+      (count === 1 ? 'is' : 'are')
                + ' now '
                + count
                + ' annotation'+ (count === 1 ? ''   : 's');

    notifications.notify({
        title:  'Annotation added',
        text:   text
    });
}
Example #10
0
exports.showNotification = function showNotification(title, text, imageURI, textClickable, onClick, onFinish, data) {
    try {
        notifications.notify({
            title: title,
            iconURL: imageURI,
            text: text,
            onClick: onClick
        });
    }
    catch (e) {
        return;
        let nb = getNotificationBox(),
            notification = nb.appendNotification(
                text,
                'jetpack-notification-box',
                imageURI || 'chrome://browser/skin/Info.png',
                nb.PRIORITY_INFO_MEDIUM,
                []
            );
        timer.setTimeout(function() {
            notification.close();
        }, 10 * 1000);
    }
    /*let alertObserver = {
        observe: function(subject, topic, data) {
            if ((topic === "alertclickcallback") && !!textClickable)
                onClick && onClick();
            else if (topic === "alertfinished")
                onFinish && onFinish();
        }
    };
    gAlertServ.showAlertNotification(imageURI, title, text, !!textClickable, data, alertObserver);*/
};
Example #11
0
 onComplete: function(response) {
     var shortURL = response.text.match(/>(http:\/\/rt\.fm\/s[^<]+)</)[1];
     clipboard.set(shortURL);
     notifications.notify({
         title: "rt.fm",
         text: shortURL + ' was copied to the clipboard',
     });
 }
function notify(msg) {
    notifications.notify({
        text: msg,
        iconURL: data.url('chirpradio.ico'),
        onClick: function(data) {
            tabs.open('http://chirpradio.org/');
        }
    });
}
Example #13
0
function Notify(text)
{
	var notifications=require("notifications");
	notifications.notify({
		title: "Next Tuenti",
		text: text,
		iconURL: data.url("tuenti64.png")
	});

}
Example #14
0
File: main.js Project: ucabgao/IRA3
 worker.on('message', function(msg){
   switch(msg.action){
     case "unload":
       wgPlayPauseSong.destroy();
       wgAlbumArt.destroy();
       wgDisplaySong.destroy();
       wgPreviousSong.destroy();
       wgNextSong.destroy();
       wgSettings.destroy();
       uiReady = false;
       break;
     
     case "nowPlaying":
       musicPlaying = true;
       songsQueued = true;
       wgPlayPauseSong.content = '<img src="'+data.url('ui/icons/control-pause.png') +
                            '" style="cursor:pointer;"/>';
       wgPlayPauseSong.label = "Play Song";
       
       //Not yet fully working, may have issues, but stable enough bug #616779
       wgDisplaySong.postMessage(msg);
       
       let albumArtURL = msg.song.artPath + 'm' +
               ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');
       
       let albumThumbURL = msg.song.artPath + 't' +
               ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');
       
       panelAlbumArt.postMessage(albumArtURL);
       
       //If the user enabled notifications display it
       if(msg.notify && simpleStorage.settings['notifications']) {
         notifications.notify({
           title: msg.song.ArtistName,
           text: msg.song.SongName,
           iconURL: albumThumbURL
         });
       }
       
       break;
     
     case "stopped":
       wgDisplaySong.postMessage({'action':'notPlaying'});
       wgPlayPauseSong.content = '<img src="'+data.url('ui/icons/control.png') +
                      '" style="cursor:pointer;"/>';
       wgPlayPauseSong.label = "Play Song";
       musicPlaying = false;
       songsQueued = msg.songsQueued;
     break;
   
     case "songProgress":
       wgDisplaySong.postMessage(msg);
     break;
   }
 });
Example #15
0
simpleStorage.on('OverQuota', function() {
    notifications.notify({
        title:  'Storage space exceeded',
        text:   'Removing older annotations'
    });

    while (simpleStorage.quotaUsage > 1)
    {
        simpleStorage.storage.annotations.shift();
    }
});
Example #16
0
		event_id = timer.setInterval(function(data){
			var myDate = new Date();
			console.log("timer interval running, "+myDate.getTime()/1000);
			notifications.notify({
			title:preferences.get("man_timer_title"),
			data:"",
			onClick: function (data) {
    				console.log(data);
  			},
			text:preferences.get("man_timer_text")});
		},
Example #17
0
	CookieMgr.initContexts(function() {
		notifications.notify({
		  title: "GooPIR",
		  text: "The add-on is ready to use. Click on the icon of the add-on's bar.",
		  data: "The add-on is ready to use. Click on the icon of the add-on's bar..",
		  onClick: function (data) {
		    console.log(data);
		  }
		});
		exports.Goopir();
	});
Example #18
0
function notify_count_quora(count)
{
    notifications.notify({
      	title: "Quorazilla",
			text: "You have "+(count)+ " new notifications",
			data: "sample",
			onClick: function (data) 
			{
				tabs.open("www.quora.com");
			}
			});
}
 shortening.shorten(tabs.activeTab.url, function(response) {
   let clipboard = require("clipboard");
   clipboard.set(response.id)
   notifications.notify({
     title: "Copied url: " + response.id + " to the clipboard.",
     text: "Click this notification to test the new Url.",
     data: response.id,
     iconUrl: data.url("google.png"),
     onClick: function(url) {
       tabs.open(url);
     }
   });
 });
Example #20
0
/******************************************
 * supporting function
 ******************************************/
function sendNotify (title, text, data, cbFunction, myIconURL)
{
    if(cbFunction != null && data != null)
    {
        notifications.notify
        ({
            title: title,
            text: text,
            data: data,
            onClick: cbFunction
        });
    }
    else
    {
        notifications.notify
        ({
            title: title,
            text: text,
            iconURL: myIconURL
        });
    }
}
Example #21
0
function Notify(url){
    var myIconURL = data.url("icon64.png");
    var notifications = require("notifications");
    notifications.notify({
        title: "Google+ Share",
        text: "Sharing "+url,
        iconURL: myIconURL,
        onClick: function (data) {
            //console.log("Click");
        }
    });


}
Example #22
0
	  onComplete: function (response) {
		  var all = response.json;
		  var versionsarray = all["versions"];
		  for (i=0; i<versionsarray.length; i++) {
			  if (versionsarray[i].id == version) {
				  tabs.open({url:versionsarray[i].url, inBackground:true});
				  found = 1;
			  }
		  }
		  
		  if (found == 0) {
		    notifications.notify({
		      text: "No hi ha cap paquet d'idioma disponible encara per a la vostra versió del Firefox",
		      iconURL: iconpopup
		    });
		  }
	  }
exports.page = function (options) {
    var google_url = 'http://translate.google.com/translate'; 
    google_url += '?&ie=UTF-8&sl='+options.from+'&tl=' + options.to + '&u=' + options.url;

    if ('https' == options.url.substr(0,5)) {
        //DOM Translation
        notifications.notify({
            'title' : 'Sorry',
            'text' : 'HTTPS Translations are not currently supported.', 
            'iconURL' : data.url('images/icons/translator-24.png')
        });
    } else {
        if (prefs.new_tab) {
            tabs.open(google_url);
        } else {
            tabs.activeTab.url = google_url;
        }
    }
};
Example #24
0
			intervals[i] = timers.setInterval(function()
			{
				console.log('run interval for ' + i);
				
				var now = new Date();
				
				if (now.getTime() >= ttTime && now.getTime() < (ttTime + 1800000))
				{
					console.log('show notification for ' + i);
					
					notifications.notify({
						title: 'FID Team Training',
						text: 'It is team training time for ' + info.name,
						iconURL: data.url('resources/images/icon_48.png')
					});
					
					timers.clearInterval(intervals[i]);
					delete intervals[i];
				}
				
			}, 60000);
 onPress: function() {
   if (/^http[s]*:\/\//.test(tabs.activeTab.url)) {
     shortening.shorten(tabs.activeTab.url, function(response) {
       let clipboard = require("clipboard");
       clipboard.set(response.id)
       notifications.notify({
         title: "Copied url: " + response.id + " to the clipboard.",
         text: "Click this notification to test the new Url.",
         data: response.id,
         iconUrl: data.url("google.png"),
         onClick: function(url) {
           tabs.open(url);
         }
       });
     });
   } else {
     notifications.notify({
       title: "Url error!",
       text: "The url " + tabs.activeTab.url + " doesn't seem to be a valid web url.",
       iconUrl: data.url("google.png")
     });
   }
 }
Example #26
0
function notify(text) {
    notifications.notify({
        title: "CopyTinyURL",
        text: text
    });
}
Example #27
0
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const data = require("self").data;
var r_nots = require("notifications");
const pageMod = require('page-mod');
var panel = require("panel").Panel({
  width: 500,
  height: 455,
  contentURL: data.url("index.html"),
});
require("widget").Widget({
  id: "mozillahispano",
  label: "Centro de Mozilla Hispano",
  contentURL: data.url("mh.png"),
  panel: panel,
});
r_nots.notify({
  title: "Centro de Mozilla Hispano",
  text: "El centro de Mozilla Hispano esta listo."
});
Example #28
0
	worker.on('message', function(data) {
		var request = data;
		switch(request.requestType) {
			case 'xmlhttpRequest':
				var responseObj = {
					XHRID: request.XHRID,
					name: request.requestType
				}
				if (request.method == 'POST') {
					Request({
						url: request.url,
						onComplete: function(response) {
							responseObj.response = {
								responseText: response.text,
								status: response.status
							}
							worker.postMessage(responseObj);
						},
						headers: request.headers,
						content: request.data
					}).post();
				} else {
					Request({
						url: request.url,
						onComplete: function(response) {
							responseObj.response = {
								responseText: response.text,
								status: response.status
							}
							worker.postMessage(responseObj);
						},
						headers: request.headers,
						content: request.data
					}).get();
				}
				
				break;
			case 'createTab':
				var focus = (request.background != true);
				tabs.open({url: request.url, inBackground: !focus });
				worker.postMessage({status: "success"});
				break;
			case 'createNotification':
				if (!request.icon) {
					// if no icon specified, make a single pixel empty gif so we don't get a broken image link.
					request.icon = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
				}
				notifications.notify({
				  title: request.title,
				  text: request.text,
				  iconURL: request.icon
				});
				break;
			case 'localStorage':
				switch (request.operation) {
					case 'getItem':
						worker.postMessage({
							name: 'localStorage',
							callbackID: request.callbackID,
							status: true, 
							key: request.itemName, 
							value: localStorage.getItem(request.itemName)
						});
						break;
					case 'removeItem':
						localStorage.removeItem(request.itemName);
						worker.postMessage({
							name: 'localStorage',
							callbackID: request.callbackID,
							status: true, 
							value: null
						});
						break;
					case 'setItem':
						localStorage.setItem(request.itemName, request.itemValue);
						worker.postMessage({
							name: 'localStorage',
							callbackID: request.callbackID,
							status: true, 
							key: request.itemName, 
							value: request.itemValue
						});
						break;
				}
				break;
			case 'addURLToHistory':
				var uri = makeURI(request.url);
				historyService.addURI(uri, false, true, null);
				break;
			default:
				worker.postMessage({status: "unrecognized request type"});
				break;
		}

	});
Example #29
0
var notifications = require("notifications");
var self = require("self");
var myIconURL = self.data.url("trang.jpg");
notifications.notify({
  text: "Em chào anh Chung!",
  iconURL: myIconURL
});

Example #30
0
const notifications = require("notifications");			// Module to display notifications
const io = require('io.js');
var history = require('history.js');

//Find add-on's directory
const dirsvc = components.classes["@mozilla.org/file/directory_service;1"]
		.getService(components.interfaces.nsIProperties);
const abs = dirsvc.get("ProfD", components.interfaces.nsIFile);
abs.append('GooPIR');

if (!io.exists(io.join(abs.path, 'init'))) {
	io.fwrite(io.join(abs.path, 'init'), '1');
	notifications.notify({
	  title: "GooPIR",
	  text: "The add-on is being configured...",
	  data: "The add-on is being configured...",
	  onClick: function (data) {
	    console.log(data);
	  }
	});
	CookieMgr.initContexts(function() {
		notifications.notify({
		  title: "GooPIR",
		  text: "The add-on is ready to use. Click on the icon of the add-on's bar.",
		  data: "The add-on is ready to use. Click on the icon of the add-on's bar..",
		  onClick: function (data) {
		    console.log(data);
		  }
		});
		exports.Goopir();
	});
}