Created
December 22, 2015 11:38
-
-
Save slorber/e6c891f0ef8adaded84a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( typeof cordova !== "undefined" ) { | |
// See https://github.com/EddyVerbruggen/Custom-URL-scheme | |
window.handleOpenURL = function handleOpenURL(url) { | |
setTimeout(function() { // setTimeout is required see plugin doc! | |
if ( url && (url.indexOf("stample://mobileclipper?") == 0) ) { | |
var queryString = parseQueryString(url); | |
if ( isClippableUrl(queryString.url) ) { | |
publishUrl(queryString.url, queryString.title); | |
} | |
else { | |
alert("not supported clipper url queryString: " + JSON.stringify(queryString)); | |
} | |
} | |
else { | |
alert("not supported url: " + url); | |
} | |
}, 0); | |
}; | |
// ANDROID | |
cordova.SharingReceptor.listen(function(data) { | |
var subject = data.intent.extras["android.intent.extra.SUBJECT"]; | |
var text = data.intent.extras["android.intent.extra.TEXT"]; | |
var fileUri = data.intent.extras["android.intent.extra.STREAM"]; | |
if ( isClippableUrl(text) ) { | |
publishUrl(text, subject); | |
} | |
else { | |
alert("not supported android clipping: " + JSON.stringify(data)); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment