Skip to content

Commit

Permalink
port the chrome extension to Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
gido committed Jun 13, 2014
1 parent 42aacdd commit 0297bd9
Show file tree
Hide file tree
Showing 8 changed files with 538 additions and 0 deletions.
Binary file added data/chosen/chosen-sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/chosen/chosen-sprite@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
435 changes: 435 additions & 0 deletions data/chosen/chosen.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions data/chosen/chosen.jquery.min.js

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions data/contentscript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$jq = jQuery.noConflict();

/**
* Create and trigger native DOM event
* @param DOMElement $el
* @param string type event type
* @param boolean bubbles
* @param boolean cancelable
*/
function triggerDOMEvent(el, type, bubbles, cancelable) {

if (typeof bubbles == "undefined") {
bubbles = true;
}
if (typeof cancelable == "undefined") {
cancelable = true;
}

var evt = document.createEvent("HTMLEvents");
evt.initEvent(type, bubbles, cancelable);
el.dispatchEvent(evt);
}

;(function($) {
$('.recording_content .menu_content').each(function() {
var $this = $(this);
var $select = $this.find('select');
var closeDiv = $this.find('div.close');

$select.chosen({ width: '260px' })
.bind('change', function(e) {
e.stopImmediatePropagation();

$(this).unbind('change');

triggerDOMEvent(this, 'change', false, true);
});

$('<a class="refresh" href="#">Refresh</a>')
.on('click', function(e) {
e.preventDefault();
$select.trigger("chosen:updated");
})
.insertAfter(closeDiv)
;
});

$('.recording_content .menu_target').click(function() {
$(this).parent().find('.menu_content select').trigger('chosen:updated');
});
})(jQuery);
4 changes: 4 additions & 0 deletions data/jquery-1.11.1.min.js

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions data/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

div.recording div.file_recording.active_menu {
width: 300px !important;
}
ul.chosen-results li {
color: #000 !important;
font-size: 11px !important;
padding: 5px 6px !important;
}
ul.chosen-results li.highlighted {
color: #fff !important;
}

div.recording div.menu_content .close {
float: left;
width: 30px;
}
div.recording div.menu_content a.refresh {
margin-left: 10px;
color: #666;
}
div.recording div.menu_content a.refresh:hover {
color: #fff;
background-color: #666;
}
21 changes: 21 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Import the page-mod API
var pageMod = require("sdk/page-mod");

// Import the self API
var self = require("sdk/self");

// Create a page mod
// It will run a script whenever a ".org" URL is loaded
// The script replaces the page contents with a message
pageMod.PageMod({
include: "*.highrisehq.com",
contentScriptFile: [
self.data.url('jquery-1.11.1.min.js'),
self.data.url('chosen/chosen.jquery.min.js'),
self.data.url("contentscript.js")
],
contentStyleFile: [
self.data.url('chosen/chosen.css'),
self.data.url('styles.css')
]
});

0 comments on commit 0297bd9

Please sign in to comment.