Remove unused JS files
This commit is contained in:
parent
e1643b4f38
commit
c10125b41d
@ -1,92 +0,0 @@
|
||||
const showMessage = (m, s) => {
|
||||
s = s == undefined ? true : s;
|
||||
console.log("Copy success (navigator.clipboard)");
|
||||
$("body").prepend("<div id='copystatus' style='display: none;'><div class='"+(s ? "succeeded" : "failed")+"'>" + m + "</div></div>");
|
||||
$("#copystatus > div").css("top", (window.scrollY + 100)+ "px");
|
||||
$("#copystatus").fadeIn(1000, function(){
|
||||
$(this).fadeOut( 1000, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const copyColourFallback = (copyInfo, attr) => {
|
||||
console.log("fallback")
|
||||
var textArea = document.createElement('textarea');
|
||||
textArea.value = copyInfo;
|
||||
|
||||
// Avoid scrolling to bottom
|
||||
textArea.style.top = '0';
|
||||
textArea.style.left = '0';
|
||||
textArea.style.position = 'fixed';
|
||||
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
setTimeout(function () {
|
||||
if (successful) {
|
||||
//copyInfo.success();
|
||||
showMessage(`Copied ${attr}.`)
|
||||
} else {
|
||||
//copyInfo.error();
|
||||
showMessage(`Copy failed (${attr}).`, false)
|
||||
}
|
||||
}, 1);
|
||||
} catch (err) {
|
||||
setTimeout(function () {
|
||||
showMessage(`Copy failed (${attr}). ${err.Message}`, false);
|
||||
|
||||
//copyInfo.error(err);
|
||||
}, 1);
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
|
||||
|
||||
export const copy = (w, t) => {
|
||||
let c = t.parent().attr("data-" + (w=="var" ? "token" : w));
|
||||
c = w == "var" ? `var(${c})` : c;
|
||||
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(c).then(function() {
|
||||
showMessage(`Copied ${w}.`);
|
||||
}, function(e) {
|
||||
copyColourFallback(c,w);
|
||||
});
|
||||
} else {
|
||||
copyColourFallback(c, w);
|
||||
}
|
||||
}
|
||||
|
||||
export const positionTooltip = () => {
|
||||
$("color-pill > span").each(function(){
|
||||
if ((Number($("p").css('font-size').replace("px","")) * 10) > $(this).offset().left) {
|
||||
$(this).children("div.tooltip-tc").attr("tip-position", "right");
|
||||
} else {
|
||||
$(this).children("div.tooltip-tc").attr("tip-position", "bottom");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
colours.positionTooltip();
|
||||
$( window ).on("resize", function(){colours.positionTooltip()});
|
||||
$("name > span, color-pill > span").on("click", function(e){
|
||||
e.preventDefault();
|
||||
let w = "";
|
||||
if (e.metaKey || e.ctrlKey || e.keyCode == 91 || e.keyCode == 224) {
|
||||
w = "var";
|
||||
} else if (e.altKey) {
|
||||
w = "token"
|
||||
} else if (e.shiftKey) {
|
||||
w = "rgb";
|
||||
} else {
|
||||
w = "hex";
|
||||
}
|
||||
copycolor.copy(w, $(this));
|
||||
});
|
||||
*/
|
@ -1,36 +0,0 @@
|
||||
// import * as cookie from './modules/cookies.js';
|
||||
|
||||
export function set (name, value, expires, path, domain, secure){
|
||||
switch(typeof expires) {
|
||||
case "number" :
|
||||
var d = new Date()
|
||||
expires = d.setTime(d + (expires*24*60*60*1000));
|
||||
break;
|
||||
case "object" :
|
||||
expires = expires.toGMTString();
|
||||
}
|
||||
document.cookie= name + "=" + escape(value) +
|
||||
((expires) ? "; expires=" + expires : "") +
|
||||
("; path=/") +
|
||||
((domain) ? "; domain=" + domain : "") +
|
||||
((secure) ? "; secure" : "");
|
||||
}
|
||||
|
||||
export function get (cname) {
|
||||
var name = cname + "=";
|
||||
var ca = document.cookie.split(";");
|
||||
for(var i = 0; i <ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)===" ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) === 0) {
|
||||
return c.substring(name.length,c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
export function remove (cname) {
|
||||
setCookie(cname, "", -1);
|
||||
};
|
@ -1,18 +0,0 @@
|
||||
// url variables into _GET object
|
||||
// import { _GET } from './modules/url-variables.js';
|
||||
|
||||
export const getURLVars = function () {
|
||||
var oResult = {};
|
||||
if (location.search.length > 0) {
|
||||
var aQueryString = (location.search.substr(1)).split("&");
|
||||
for (var i = 0; i < aQueryString.length; i++) {
|
||||
var aTemp = aQueryString[i].split("=");
|
||||
if (aTemp[1].length > 0) {
|
||||
oResult[aTemp[0]] = decodeURIComponent(aTemp[1].replace(/\+/g, '%20'));
|
||||
}
|
||||
}
|
||||
}
|
||||
return oResult;
|
||||
|
||||
}
|
||||
export let vars = getURLVars();
|
@ -1,55 +0,0 @@
|
||||
|
||||
// (function ($){
|
||||
// $.fn.oneClickSelect = function () {
|
||||
// return $(this).on('click', function () {
|
||||
// // In here, "this" is the element
|
||||
// var range, selection;
|
||||
// if (window.getSelection) {
|
||||
// selection = window.getSelection();
|
||||
// range = document.createRange();
|
||||
// range.selectNodeContents(this);
|
||||
// selection.removeAllRanges();
|
||||
// selection.addRange(range);
|
||||
// } else if (document.body.createTextRange) {
|
||||
// range = document.body.createTextRange();
|
||||
// range.moveToElementText(this);
|
||||
// range.select();
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
// })(jQuery);
|
||||
|
||||
|
||||
export function init(jq) {
|
||||
console.log(jq)
|
||||
console.log(window.$);
|
||||
if (jq == window.jQuery)
|
||||
console.log("match")
|
||||
window.jQuery("title").html();
|
||||
// $("article").css({"background-color", "red"})
|
||||
window.$.fn.extend({
|
||||
// Your custom function name
|
||||
oneClickSelect: function() {
|
||||
// Code for your custom function
|
||||
console.log("This is my custom function!");
|
||||
}
|
||||
});
|
||||
|
||||
// $.fn.oneClickSelect = function () {
|
||||
// return $(this).on('click', function () {
|
||||
// // In here, "this" is the element
|
||||
// var range, selection;
|
||||
// if (window.getSelection) {
|
||||
// selection = window.getSelection();
|
||||
// range = document.createRange();
|
||||
// range.selectNodeContents(this);
|
||||
// selection.removeAllRanges();
|
||||
// selection.addRange(range);
|
||||
// } else if (document.body.createTextRange) {
|
||||
// range = document.body.createTextRange();
|
||||
// range.moveToElementText(this);
|
||||
// range.select();
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
}
|
Loading…
Reference in New Issue
Block a user