mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2024-12-09 23:25:49 +01:00
3ec9e603df
* feat(ActionExtension): Improve "Open in Mastodon" by using Search aPI * Add code comment
31 lines
627 B
JavaScript
31 lines
627 B
JavaScript
//
|
|
// Action.js
|
|
// OpenInActionExtension
|
|
//
|
|
// Created by Marcus Kida on 03.01.23.
|
|
//
|
|
|
|
var Action = function() {};
|
|
|
|
Action.prototype = {
|
|
run: function(arguments) {
|
|
var payload = {
|
|
"url": document.documentURI
|
|
}
|
|
|
|
arguments.completionFunction(payload)
|
|
},
|
|
finalize: function(arguments) {
|
|
const alertMessage = arguments["alert"]
|
|
const openURL = arguments["openURL"]
|
|
|
|
if (alertMessage) {
|
|
alert(alertMessage)
|
|
} else if (openURL) {
|
|
window.location = openURL
|
|
}
|
|
}
|
|
};
|
|
|
|
var ExtensionPreprocessingJS = new Action
|