⤵
- Install https://pngquant.org/
$ brew install pngquant
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Hello World!</title> | |
</head> | |
<body> | |
<ul> | |
<li>appUserModelId: "<script>document.write(require("electron").remote.getGlobal("appUserModelId"))</script>"</li> | |
<li>Electron version: <script>document.write(process.versions.electron)</script></li> |
⤵
$ brew install pngquant
// | |
// Example usage: phantomjs screenshot.js http://yahoo.com /tmp/yahoo.png | |
// | |
var system = require('system'); | |
var url = system.args[1]; | |
var filename = system.args[2]; | |
var page = new WebPage(); | |
page.open(url, function (status) { |
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/ | |
1.) Open any application | |
2.) Press and hold the power button until the slide to shutdown swipe bar appears. | |
3.) Release Power button | |
4.) Press and hold Home button Lightly | |
until screen returns to icon screen |
Trix.config.textAttributes.red = { | |
style: { backgroundColor: "red" } | |
} | |
element.editor.activateAttribute("red") | |
// See available attribute options in: | |
// https://github.com/basecamp/trix/blob/master/src/trix/config/text_attributes.coffee | |
// https://github.com/basecamp/trix/blob/master/src/trix/config/block_attributes.coffee |
buttonHTML = """<button type="button" class="attach" data-action="x-attach">Attach Files</button>""" | |
fileInputHTML = """<input type="file" multiple>""" | |
$(Trix.config.toolbar.content).find(".button_group.block_tools").append(buttonHTML) | |
$(document).on "trix-action-invoke", ($event) -> | |
if $event.originalEvent.actionName is "x-attach" | |
editorElement = $event.target | |
editorElement.focus() |
BC.registerElement "bc-require", | |
createdCallback: -> | |
@setAttribute("pending", "") | |
attachedCallback: -> | |
BC.ready => | |
if Loader.find(@script)?.loaded | |
@activate() | |
else | |
@deactivate() |
<!doctype html> | |
<html> | |
<head> | |
<title>Custom elements test</title> | |
</head> | |
<body> | |
<h3>Custom elements from HTML</h3> | |
<ol class="from-html" start="0"> |
This is the example webpack.config.js
on https://webpack.js.org/:
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
}
}
(async () => { | |
if (await mutionObserverIsBuggy()) { | |
patchInnerHTML() | |
} | |
})() | |
function mutionObserverIsBuggy(): Promise<boolean> { | |
return new Promise(resolve => { | |
const element = document.createElement("div") | |
element.innerHTML = "<a><em></em></a>" |