Commit 83f56b17 authored by Jean M's avatar Jean M
Browse files

Misskey + removing unused code

parent cab93cea
......@@ -101,6 +101,10 @@
<input type="radio" class="form-radio" name="platform" id="msb-diaspora" value="diaspora">
<label class="form-check-label" for="msb-diaspora">Diaspora</label>
</li>
<li>
<input type="radio" class="form-radio" name="platform" id="msb-misskey" value="misskey">
<label class="form-check-label" for="msb-misskey">Misskey</label>
</li>
</ul>
</div>
</div>
......
......@@ -22,32 +22,8 @@ const URL_REGEX = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?$/
function msbShareButtonAction(name, target, platform) {
let msbInstanceAddress = ''
if (msbInstanceAddress.length > 0) {
// USING THE COOKIE
switch(platform) {
case "pleroma":
window.open(`${msbInstanceAddress}/share?message=${name}%20${target}`, `__blank`)
break;
case "mastodon":
window.open(`${msbInstanceAddress}/share?text=${name}%20${target}`, `__blank`)
break;
case "gnusocial":
window.open(`${msbInstanceAddress}/?action=newnotice&status_textarea=${name}%20${target}`, `__blank`)
break;
case "friendica":
window.open(`${msbInstanceAddress}/bookmarklet?url=${target}&title=${name}&jump-doclose`, `__blank`)
break;
case "diaspora":
window.open(`${msbInstanceAddress}/bookmarklet?url=${target}&title=${name}&jump-doclose`, `__blank`)
break;
default:
alert("nothing chosen! should not happen...");
}
}
else {
if (msbConfig && msbConfig.addressFieldSelector) {
msbOnShare(name, target)
}
if (msbConfig && msbConfig.addressFieldSelector) {
msbOnShare(name, target)
}
}
......@@ -85,6 +61,8 @@ function msbOnShare(_name, _target) {
}
}
// Several platform use the same sharing URLs, but we keep them all separated for readability
// and consistency purposes.
switch(msbPlatform) {
case "pleroma":
window.open(`${msbInstanceAddress}/share?message=${name}%20${target}`, `__blank`)
......@@ -101,6 +79,9 @@ function msbOnShare(_name, _target) {
case "diaspora":
window.open(`${msbInstanceAddress}/bookmarklet?url=${target}&title=${name}&jump-doclose`, `__blank`)
break;
case "misskey":
window.open(`${msbInstanceAddress}/share?text=${name}%20${target}`, `__blank`)
break;
default:
alert("nothing chosen! should not happen...");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment