Skip to content

Instantly share code, notes, and snippets.

View freaktechnik's full-sized avatar
🚞
I like trains

Martin Giger freaktechnik

🚞
I like trains
View GitHub Profile
@freaktechnik
freaktechnik / example.js
Last active April 27, 2016 16:00
Running native commands in WebExt
chrome.browserAction.onClick.addListener(() => {
var port = chrome.runtime.invokeNativeCommand("livestreamer", ["https://twitch.tv/pax"]);
port.onDisconnect.addListener(() => {
// TODO could we get the exit code here?
console.log("Livestreamer quit");
});
});
# HG changeset patch
# User Martin Giger <[email protected]>
# Parent f23b538a3e3bb674e22bab5ef6b8d816531b155f
diff --git a/chat/content/convbrowser.xml b/chat/content/convbrowser.xml
--- a/chat/content/convbrowser.xml
+++ b/chat/content/convbrowser.xml
@@ -773,16 +773,28 @@
// The content area was resized and auto-scroll is enabled,
// make sure the last inserted element is still visible
/**
* A simple module to use the permission manager
* @module permission-manager
* @see {@link https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPermissionManager}
*/
"use strict";
/**
* @external nsISimpleEnumerator
* @see {@link https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISimpleEnumerator}
const tabs = require("sdk/tabs");
var optionsTab;
function OptionsPanel(){
if(optionsTab == null){
tabs.once("open", (tab) => {
optionsTab = tab;
optionsTab.once("close", () => {
optionsTab = null;
});
});
var CustomizableUI = require("resource:///modules/CustomizableUI.jsm");
CustomizableUI.createWidget({
id: spat.togglebuttonid,
type: "custom",
removable: true,
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(doc) {
var toggleButton = doc.createElement('toolbarbutton');
toggleButton.setAttribute('id', spat.togglebuttonid);
const { CC, Cc,Ci } = require("chrome");
// Open a socket for listening for incoming connections (server)
const ServerSocket = CC("@mozilla.org/network/server-socket;1", "nsIServerSocket");
var openSocket = (port, loopBack) => {
let ss = new ServerSocket();
// start the socket
ss.init(port, loopBack, -1);
// start listening for connections
search_button_label=Suchen
search_button_tooltiptext=Durchsucht die Inhalte der Adressleiste, Auswahl und Zwischenablage.
urlbarMode_title=Adressleistenverhalten
urlbarMode_description=Interaktion der Adressleiste mit Fokus. Fix: Feste Größe, Wachsend: Wird größer wenn fokussiert, Flexibel: Nutzt allen von Tabs ungenutzten Platz.
urlbarMode_options.Fixed=Fix
urlbarMode_options.Sliding=Wachsend
urlbarMode_options.Flexible=Flexibel
urlbarBlur_title=Adressleistenbreite wenn nicht fokussiert
// This removes the need to import Ci and the XPCOMUtils
const { Class } = require("sdk/core/heritage");
const { Unknown } = require('sdk/platform/xpcom');
let bmListener = Class({
extends: Unknown,
interfaces: [ "nsINavBookmarkObserver" ],
//this one will take care of everything since other events are buggy or bad logic
onItemChanged: function(bId, prop, an, nV, lM, type, parentId, aGUID) {
//console.log("onItemChanged", "bId: "+bId, "property: "+prop, "isAnno: "+an, "new value: "+nV, "lastMod: "+lM, "type: "+type, "parentId:"+parentId, "aGUID:"+aGUID);
I/stdout (15148): console.log: jetpack-homepanel: 03dcc2ed-70a6-4fd2-99d5-ed2865f88f3f@jetpack-homepanel
I/stdout (15148): console.log: jetpack-homepanel: After first yield 03dcc2ed-70a6-4fd2-99d5-ed2865f88f3f@jetpack-homepanel
I/stdout (15148): console.log: jetpack-homepanel: After first yield 03dcc2ed-70a6-4fd2-99d5-ed2865f88f3f@jetpack-homepanel
I/stdout (15148): console.log: jetpack-homepanel: Before save 47facd51-8e1b-48c6-8539-39c218bec856@jetpack-homepanel
//declare a promise to handle this treatement
//would be nice to call the same code many times
//use it as a function
Task.spawn(function* () {
//global variable
let id=[];
let db = yield Sqlite.openConnection({ path: myPath});
try {
let row = yield db.execute("SELECT id FROM 'plates'");