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
var uas = () => {
// Once could just iterate through the ASCII code but finding the characters in builtin Objects is more fun!
var emptyString = new String();
var l = (new String(null)).split(emptyString).pop();
var earr = (new String(undefined)).split(emptyString);
var d = earr.pop();
var e = earr.pop();
var oarr = (new String(Object())).split(emptyString);
<?php
switch() {
case 'Warenkorb':
$controller = new CheckoutController($this->basketPageId, true, CheckoutController::SHOP_PAYMENTMETHODS, CheckoutController::SHOP_STEPS, $_REQUEST['step']);
$content = $controller->getCurrentContent();
include(TEMPLATE_DIR . "/entry-basket.html");
break;
}
@freaktechnik
freaktechnik / index.html
Created November 27, 2016 20:00
Simple ordered multiselect. Note that you'll have to use JS to send all the options in the #target multiselect.
<select multiple id="source">
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
<option>E</option>
</select>
<div class="addremove">
<button id="add">&gt;</button><br>
<button id="remove">&lt;</button>
'use strict';
// OMITTED: Working code
/** Serialize the body of a Response to a data: URI */
function responseToDataURI(response) {
return new Promise(function(resolve, reject) {
try {
let reader = new FileReader();
reader.addEventListener("load", function(e) {

On addons.mozilla.org Reviews

Files generated by webpack and friends are compiled files. You have to upload the source you generated your extension from to AMO for review of a listed extension. This will mean that your extension has to be reviewed by an admin-reviewer, which will result in a longer wait time in queue.

If you are ok with that trade-off there are a few measures you can take to make the review easier:

  • Don't minify the generated code (UglifyJsPlugin for webpack)
  • Don't use loaders that transform the JS output (like babel or similar)
  • Don't include third-party libraries in your file, instead directly use the original source file

Steps to Reproduce

  • Do some stuff
  • And some other
  • Maybe even break it

Expected Results

It should've worked.

Actual Results

It didn't work.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
</head>
<body>
<script src="https://player.twitch.tv/js/embed/v1.js"></script>
<div id="player"></div>
<script type="text/javascript">
var options = {
<select id="resolution">
<option value="1080p60" label="1080p 60FPS">
<option value="720p" label ="720p 30FPS">
<option value="mp3" label="Audio only (mp3)">
</select>
<script src="index.js"></script>
@freaktechnik
freaktechnik / l10n.js
Last active April 26, 2024 22:10
Drop-in script to localize HTML sites in WebExtensions like it was the Add-on SDK.
/**
* Translates a HTMl page in the web l10n style from the Add-on SDK with
* WebExtensions strings.
* Large parts of the logic are very similar to the SDK implmentation.
* All you have to do to use this in a document is load it.
*
* It supports some additional attributes:
* - The "translate" attribute is fully respected (see
* https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate)
* - "data-l10n-nocontent" means that the text content of the element
new Promise((resolve, reject) => {
passwords.search({
onError: reject,
onComplete: resolve
});
}).then((asdf) => {
foo();
}, (err) => {
console.error('passwords failed');
console.error(err);