Add web+diaspora:// links handler installation

This commit is contained in:
cmrd Senya 2018-06-11 18:21:57 +03:00 committed by Benjamin Neff
parent 6f812a5b8f
commit 80dfdcd6af
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 18 additions and 0 deletions

View file

@ -46,3 +46,4 @@
//= require bootstrap-markdown/bootstrap-markdown
//= require helpers/markdown_editor
//= require jquery.are-you-sure
//= require protocol-handler

View file

@ -0,0 +1,17 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
function registerDiasporaLinksProtocol() {
var protocol = location.protocol;
var slashes = protocol.concat("//");
var host = slashes.concat(window.location.hostname);
if (location.port) {
host = host.concat(":" + location.port);
}
window.navigator.registerProtocolHandler("web+diaspora", host.concat("/link?q=%s"), document.title);
}
if (typeof (window.navigator.registerProtocolHandler) === "function") {
registerDiasporaLinksProtocol();
}