🏳️🌈
- GitHub Staff
- http://digitarald.de
- @digitarald
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requirejs = require('requirejs') | |
jspath = __dirname + '/views/scripts'; | |
requirejs.optimize( | |
baseUrl: jspath | |
wrap: | |
start: ';(function(undefined) { "use strict";' | |
end: '}).call(this);' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pubsub | |
constructor: -> | |
@topics = [] | |
@scopes = [] | |
@methods = [] | |
acquire: (host) -> | |
@acquired = true | |
host.pubsub = @ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(a,b){if(/\/$/.test(b))b+="manifest.webapp";var c=a.install(b);c.onsuccess=c.onerror=function(){if(c.error)alert(b+"/n"+c.error.name);else c.result.launch()}})(navigator.mozApps,(getSelection().toString()||location.href).trim()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "My App", | |
"description": "My elevator pitch goes here", | |
"launch_path": "/", | |
"icons": { | |
"128": "/img/icon-128.png" | |
}, | |
"developer": { | |
"name": "Your Name or Organization", | |
"url": "http: //your-homepage-here.org" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
var target = 0; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('MozActivity' in window) { | |
document.getElementById('my-file-input').addEventListener('click', function(evt) { | |
evt.preventDefault(); | |
var picking = new MozActivity({ | |
name: 'pick', | |
data: { | |
type: 'image/jpg' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var selfReq = navigator.mozApps.getSelf(); | |
isMozRuntime = false; | |
selfReq.onsuccess = function() { | |
isMozRuntime = selfReq.result; | |
if (isMozRuntime) { | |
// Responsive action to mozilla apps runtime (force links in new window | |
respondToMozRuntime(); | |
} | |
}; | |
function respondToMozRuntime() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('MozActivity' in window) { // feature detection | |
// When getting elements, like document.getElementsByClassName('video-links') | |
// rather use event delegation, like | |
// `jQuery(document).on('click', 'video', fn) | |
document.getElementById('video-1').onclick = function(evt) { | |
evt.preventDefault(); // Prevent click behaviour | |
console.log("Launching Video!"); | |
var activity = new MozActivity({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Issue a register() call | |
* To register to listen for a notification, you simply call push.register | |
*/ | |
var pushReq = navigator.push.register(); | |
pushReq.onsuccess = function(e) { | |
alert('pushReq.onsuccess'); | |
var endpoint = pushReq.result; | |
// Store it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example code, use with caution! | |
// Events and .hidden property requires no prefix since 18 | |
// Set current language on launch | |
document.documentElement.lang = navigator.language; | |
function visibilityChange() { | |
// user went off page, ignore | |
if (document.hidden) return; |