diaspora/app/assets/javascripts/helpers/protocol_handler.js
Dennis Schubert 8709c45d30
Move the protocol handler into a proper helper module
Previous file history in 80dfdcd6af, couldn't keep it.
2018-07-13 10:18:48 +02:00

22 lines
647 B
JavaScript

// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
Diaspora.ProtocolHandler = {
register: function() {
if (typeof (window.navigator.registerProtocolHandler) !== "function") {
return false;
}
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);
return true;
}
};
Diaspora.ProtocolHandler.register();