How to use the self.data.url function in self

To help you get started, we’ve selected a few self examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Gozala / sky-edit / main.js View on Github external
onRequest: function(request, response) {
    try {
      // All the editor content is located under 'edit:///' so to get a path
      // we just strip that out.
      var path = request.uri.replace('edit:///', '')
      // If requested path was diff from 'edit:///...', then we load editor.
      path = ~path.indexOf('edit:') ? 'index.html' : path
      response.uri = data.url(path)
    } catch(error) {
      console.exception(error)
    }
  }
}).register()
github bgirard / Gecko-Profiler-Addon / lib / remoteHost.js View on Github external
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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 {Cc,Ci,Cu} = require("chrome");

let main = require("main");
let data = require("self").data;
let cmdRunnerModule = Cu.import(data.url("CmdRunner.jsm"));

String.prototype.endsWith = function(suffix) {
  return this.indexOf(suffix, this.length - suffix.length) !== -1;
};

function RemoteHost(options, cb, error_cb) {
  this._adbCommand = "adb";
  this._addr2lineCommand = "addr2line";
  this._systemLibCache = "/tmp/";
  this._fennecLibCache = "/tmp/";
  this._serial = options.serial;
  if (options.serial) {
    this._adbCommand = "adb -s " + options.serial;
  }
  if (options.addr2lineCommand) {
    this._addr2lineCommand = options.addr2lineCommand;
github bgirard / Gecko-Profiler-Addon / lib / main.js View on Github external
var OLD_UI_URL = "http://varium.fantasytalesonline.com/cleopatra/";
var DEFAULT_UI_URL = "http://people.mozilla.com/~bgirard/cleopatra/";
//var DEFAULT_UI_URL = "file:///Users/bgirard/ben/sps/cleopatra/index.html";
//var DEFAULT_UI_URL = "http://localhost/~markus/cleopatra/";
var DEFAULT_PROFILE_FORMAT = "string"; // or json
//var DEFAULT_PROFILE_FORMAT = "json";

let remote = require("remote");
let prefs = require("prefs");
let data = require("self").data;
let clipboard = require("clipboard");
let timers = require("timers");
let tabs = require("tabs");
let Request = require("request").Request;

let symbolicateModule = Cu.import(data.url("SymbolicateModule.jsm"));
let cmdRunnerModule = Cu.import(data.url("CmdRunner.jsm"));

var profiler = null;
var profilerFeatures = [];
var featuresToUse = [];
var startedWithFeatures = [];
var spsWidget = null;
var panel = null;
var c = 0;
var settingsTab = null;
var settingsTabPort = null;

String.prototype.endsWith = function(suffix) {
      return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
github canuckistani / html5slides / addon / lib / main.js View on Github external
onClick: function() {
    
    if (typeof(tabs.activeTab._worker) == "undefined") {
      let worker = tabs.activeTab.attach({
        contentScriptFile: data.url('alertbot.js')
      });
      tabs.activeTab._worker = worker;
    }
    tabs.activeTab._worker.port.emit('alert', _("str_hello_world"));
  }
});
github aarroyoc / firefox-addons / next-tuenti / src / lib / main.js View on Github external
function OpenGadgetWindow()
{
	var panel=require("panel").Panel({
		width: 800,
		height: 600,
		contentURL: data.url("gadget.html"),
		contentScriptFile: data.url("gadget.js")
	});
	panel.show();
	panel.port.emit("default",storage.gadget);
	panel.port.on("apply",function(gadget){
		storage.gadget=gadget;
	});
}
function SaveImage(imageurl)
github aarroyoc / firefox-addons / next-tuenti / src / lib / main.js View on Github external
function OpenStyleWindow()
{
	var panel=require("panel").Panel({
		width: 800,
		height: 600,
		contentURL: data.url("styles.html"),
		contentScriptFile: data.url("styles.js")
	});
	panel.show();
	panel.port.emit("default",storage.colorHeader,storage.backgroundImage,storage.notificationsColor);
	panel.port.on("apply",function(colorHeader,backgroundImage,notificationsColor){
		storage.colorHeader=colorHeader;
		storage.backgroundImage=backgroundImage;
		storage.notificationsColor=notificationsColor;
	});
}
function OpenGadgetWindow()
github aarroyoc / firefox-addons / next-tuenti / src / lib / main.js View on Github external
function OpenStyleWindow()
{
	var panel=require("panel").Panel({
		width: 800,
		height: 600,
		contentURL: data.url("styles.html"),
		contentScriptFile: data.url("styles.js")
	});
	panel.show();
	panel.port.emit("default",storage.colorHeader,storage.backgroundImage,storage.notificationsColor);
	panel.port.on("apply",function(colorHeader,backgroundImage,notificationsColor){
		storage.colorHeader=colorHeader;
		storage.backgroundImage=backgroundImage;
		storage.notificationsColor=notificationsColor;
	});
}
function OpenGadgetWindow()
github mozilla / openwebapps / addons / firefox / jetpack / appetizer / lib / apps.js View on Github external
onClick: function() {
    console.log("Widget got onClick");
    let panel = panels.Panel({
      height:150,
      width:640,
      contentURL: data.url("dock.html"),
      contentScriptFile: data.url("dock.js"),
      contentScript: "let gApplications = " + JSON.stringify(listFunc()),
      onMessage: function(req) {}
    });
    openPanelOnLocationBar(panel);
  }
});
github GaloisInc / FiveUI / tools / addon-sdk-1.12 / examples / annotator / lib / main.js View on Github external
widget.port.on('left-click', function() {
    console.log('activate/deactivate');
    widget.contentURL = toggleActivation() ?
              data.url('widget/pencil-on.png') :
              data.url('widget/pencil-off.png');
  });
github rik / au-revoir-utm / lib / main.js View on Github external
exports.main = function() {
    pageMod.PageMod({
        include: ["*"],
        contentScriptFile: data.url("utm.js"),
        contentScriptWhen: "start",
        attachTo: ["existing", "top"]
    })
}

self

Python-like class sugar. No more "var that = this"!

MIT
Latest version published 12 years ago

Package Health Score

45 / 100
Full package analysis

Popular self functions