Provide mechanism to get tab click (Fixes #4)
This commit is contained in:
@@ -21,7 +21,7 @@ const font = {
|
||||
size: 0
|
||||
}
|
||||
|
||||
const copyColourFallback = (copyInfo, attr) => {
|
||||
const copyFallback = (copyInfo, attr) => {
|
||||
console.log("fallback")
|
||||
var textArea = document.createElement('textarea');
|
||||
textArea.value = copyInfo;
|
||||
@@ -157,10 +157,10 @@ module.exports = {
|
||||
navigator.clipboard.writeText(c).then(function() {
|
||||
showMessage(`Copied ${w}.`);
|
||||
}, function(e) {
|
||||
copyColourFallback(c,w);
|
||||
copyFallback(c,w);
|
||||
});
|
||||
} else {
|
||||
copyColourFallback(c, w);
|
||||
copyFallback(c, w);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -178,6 +178,23 @@ module.exports = {
|
||||
},
|
||||
getCSS: (el, prop, b = false) => {
|
||||
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
||||
},
|
||||
getTabPath: (t) => {
|
||||
let url = window.location.toString();
|
||||
url = url.indexOf("?") > 0 ? url.substring(0,url.indexOf("?")) : url;
|
||||
url = `${url}?p=${t.closest("article").getAttribute("data-path")}#${t.getAttribute("id")}`
|
||||
let type = "URL";
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(url).then(function() {
|
||||
showMessage(`Copied ${type}.`);
|
||||
}, function(e) {
|
||||
copyFallback(url,type);
|
||||
});
|
||||
} else {
|
||||
copyFallback(url, type);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
init: (args = {}) => {
|
||||
const url = getURLVars();
|
||||
|
||||
Reference in New Issue
Block a user