diff --git a/assets/main.js b/assets/main.js
deleted file mode 100644
index 368eca1..0000000
--- a/assets/main.js
+++ /dev/null
@@ -1,49 +0,0 @@
-hljs.initHighlightingOnLoad();
-
-document.addEventListener('DOMContentLoaded', function() {
- var clipboard = new Clipboard('.btn');
- var btns = clipboard.triggers;
-
- for (var i = 0; i < btns.length; i++) {
- btns[i].addEventListener('success', function(e) {
- e.detail.clearSelection();
-
- console.info('Action:', e.detail.action);
- console.info('Text:', e.detail.text);
-
- showTooltip(e.currentTarget, 'Copied!');
- });
-
- btns[i].addEventListener('error', function(e) {
- showTooltip(e.currentTarget, messageFallback(e.detail.action));
- });
-
- btns[i].addEventListener('mouseleave', function(e) {
- e.currentTarget.setAttribute('class', 'btn');
- e.currentTarget.removeAttribute('aria-label');
- });
- }
-
- function showTooltip(elem, msg) {
- elem.setAttribute('class', 'btn tooltipped tooltipped-s');
- elem.setAttribute('aria-label', msg);
- }
-
- // Simplistic detection, do not use it in production
- function messageFallback(action) {
- var actionMsg = '';
- var actionKey = (action === 'cut' ? 'X' : 'C');
-
- if(/iPhone|iPad/i.test(navigator.userAgent)) {
- actionMsg = 'No support :(';
- }
- else if (/Mac/i.test(navigator.userAgent)) {
- actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
- }
- else {
- actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
- }
-
- return actionMsg;
- }
-});
diff --git a/assets/scripts/clipboard.js b/assets/scripts/clipboard.js
new file mode 100644
index 0000000..e929fcf
--- /dev/null
+++ b/assets/scripts/clipboard.js
@@ -0,0 +1,14 @@
+var clipboard = new Clipboard('.btn');
+
+clipboard.on('success', function(e) {
+ e.clearSelection();
+
+ console.info('Action:', e.action);
+ console.info('Text:', e.text);
+
+ showTooltip(e.trigger, 'Copied!');
+});
+
+clipboard.on('error', function(e) {
+ showTooltip(e.trigger, fallbackMessage(e.action));
+});
diff --git a/assets/scripts/main.js b/assets/scripts/main.js
new file mode 100644
index 0000000..d3288ca
--- /dev/null
+++ b/assets/scripts/main.js
@@ -0,0 +1,33 @@
+var btns = document.querySelectorAll('.btn');
+
+for (var i = 0; i < btns.length; i++) {
+ btns[i].addEventListener('mouseleave', function(e) {
+ e.currentTarget.setAttribute('class', 'btn');
+ e.currentTarget.removeAttribute('aria-label');
+ });
+}
+
+function showTooltip(elem, msg) {
+ elem.setAttribute('class', 'btn tooltipped tooltipped-s');
+ elem.setAttribute('aria-label', msg);
+}
+
+// Simplistic detection, do not use it in production
+function fallbackMessage(action) {
+ var actionMsg = '';
+ var actionKey = (action === 'cut' ? 'X' : 'C');
+
+ if(/iPhone|iPad/i.test(navigator.userAgent)) {
+ actionMsg = 'No support :(';
+ }
+ else if (/Mac/i.test(navigator.userAgent)) {
+ actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
+ }
+ else {
+ actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
+ }
+
+ return actionMsg;
+}
+
+hljs.initHighlightingOnLoad();
diff --git a/index.html b/index.html
index 6780dfb..daadc67 100644
--- a/index.html
+++ b/index.html
@@ -185,7 +185,9 @@ var btns = clipboard.triggers;
-
+
+
+