Skip to content

Instantly share code, notes, and snippets.

@noromanba
Last active July 7, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noromanba/24288bbc6f801e710d22fa6c032efa35 to your computer and use it in GitHub Desktop.
Save noromanba/24288bbc6f801e710d22fa6c032efa35 to your computer and use it in GitHub Desktop.
append Hatena::Bookmark w/ canonical in new tab/window for Bookmarklet
// ==Bookmarklet==
// @name +B!
// @namespace http://noromanba.flavors.me
// @description append Hatena::Bookmark w/ canonical in new tab/window for Bookmarklet
// @include http://*
// @include https://*
// @version 2016.7.7.0
// @homepage https://gist.github.com/noromanba/de465f65a50b171322431fadee4ce034
// @contributor dankogai http://let.hatelabo.jp/dankogai/let/gYC-xpO_j7qpDw
// @contributor noromanba http://let.hatelabo.jp/noromanba/let/gYC-y5_1hrbuWA
// @contributor noromanba http://let.hatelabo.jp/noromanba/let/gYC-y9Ggo7jqKg (Fork of)
// @author noromanba http://noromanba.flavors.me
// @license MIT License http://opensource.org/licenses/MIT
// ==/Bookmarklet==
// UserScript-like Metadata c.f.
// https://github.com/mrcoles/bookmarklet
// Devel
// https://gist.github.com/noromanba/de465f65a50b171322431fadee4ce034
// http://userjs.up.seesaa.net/js/bookmarklet.html
//*/
(() => {
'use strict';
'https://gist.github.com/noromanba/de465f65a50b171322431fadee4ce034';
// canonical c.f.
// http://let.hatelabo.jp/noromanba/let/hLHVzOTQjfYH
// https://gist.github.com/noromanba/d730ccf3ae5e6916cd60
const canonical = () => {
return (document.querySelector('head meta[property="og:url"][content]') || {}).content ||
(document.querySelector('head link[rel="canonical"][href]') || {}).href ||
location.href;
};
window.open(`http://b.hatena.ne.jp/my/add.confirm?url=${canonical()}&title=${document.title}`, '_blank');
})();
/*/
javascript:(()=>{'https://gist.github.com/noromanba/de465f65a50b171322431fadee4ce034';const canonical=()=>{return(document.querySelector('head meta[property="og:url"][content]')||{}).content||(document.querySelector('head link[rel="canonical"][href]')||{}).href||location.href;};const canon=canonical();window.open(`http://b.hatena.ne.jp/my/add.confirm?url=${canon}&title=${document.title}`,'_blank');})();
//*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment