JavaScript で下記4点を連想配列として用いる場合の使い分け方を解説します。
- オブジェクト初期化子
Object.create(null)
- Map
- WeakMap
// ==UserScript== | |
// @name [Mastodon] This is not ⭐, but 🍮! | |
// @namespace hen.acho.co | |
// @include https://*/web/* | |
// @version 1.180415 | |
// @description replace misskey's star button with pudding | |
// @downloadURL https://gist.github.com/pacochi/7a529cc0a344ba90e7b764f944e037e0/raw/mastodon_misskey_pudding.user.js | |
// @run-at document-idle | |
// @grant none | |
// ==/UserScript== |
// ==UserScript== | |
// @name Misskey - Quick reaction | |
// @namespace https://github.com/unarist/ | |
// @version 0.3.1 | |
// @description Click existing reaction to cast same one | |
// @author unarist | |
// @match https://misskey.xyz/* | |
// @require https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js | |
// @downloadURL https://gist.github.com/unarist/3d99742d3bb2af5d500b494400996aca/raw/misskey-quick-reaction.user.js | |
// @grant none |
/* | |
href | |
┌────────────────────────────────────────┴──────────────────────────────────────────────┐ | |
origin │ | |
┌────────────┴──────────────┐ │ | |
│ authority │ | |
│ ┌───────────────┴───────────────────────────┐ │ | |
│ │ host resource | |
│ │ ┌──────────┴─────────────────┐ ┌────────────┴───────────┬───────┐ | |
│ │ hostname │ pathname │ │ |
Copyright 2020 Jason Strothmann | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
document.addEventListener('wheel', function(e) | |
{ | |
if(e.type != 'wheel') | |
{ | |
return; | |
} | |
let delta = ((e.deltaY || -e.wheelDelta || e.detail) >> 10) || 1; | |
delta = delta * (-300); | |
document.documentElement.scrollLeft -= delta; | |
// safari needs also this |
.frame | |
.card | |
img.background-img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/544318/hills.jpeg") |
ウインドウのスクロール量を取得するクラスブラウザなコードを考えます。
<div class="al"></div> | |
<div class="container"> | |
<div class="header">Sign In</div> | |
<div class='info'>*Click on the input boxes</div> | |
<input id='username' class='text' onfocus="handle2()" class='inc2' type="text" name="Username" placeholder='Username' value=""> | |
<!-- Had to remove the type "password" due to the browser user credential's autofill--> | |
<input id='password' class='pass' onfocus="handle1()" class='inc1' type="pass" name="Password" placeholder='Password' value=""> | |
<button>Sign In</button> | |
<svg width="390" height="549" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<rect id='rect' class='rect1' x="45px" y="300px" rx="27" ry="27" width="300px" height="50px" style="stroke: #fff; stroke-width: 1px; fill: #000" /> |
Markdown files allow embedding images in it. However it requires the image to be hosted at some location and we can add the url of the image to embed it.
Example:

We can use services like imgur or other services to host the images and use the hosted URL.