}
let clip_input = document.getElementById("clipboard");
- if(clip_input.value == '')
+ if(clip_input.textContent == '')
get_clipboard_contents();
- let clip = trim(clip_input.value);
+ let clip = trim(clip_input.textContent);
- if(clip_input.value == '') return;
+ if(clip_input.textContent == '') return;
let url;
}
});
-window.addEventListener('load', (e) => {
- document.getElementById('button-list-container').addEventListener('click', link_clicked);
+ e.preventDefault();
+ return false;
+}
- document.addEventListener('change', (e) => {
- if ( !e.target.classList.contains('icedeb-option') )
- return;
-
- save_settings();
- });
+function get_clipboard_contents() {
+ document.getElementById('error').classList.add('hidden');
let clip_input = document.getElementById("clipboard");
clip_input.focus();
err.textContent = 'Error retrieving clipboard contents';
err.classList.remove('hidden');
}
+}
+
+window.addEventListener('DOMContentLoaded', (e) => {
+ document.querySelectorAll('.icedeb-button, #button-list-container a')
+ .forEach(function(el){
+ el.addEventListener('mouseup', link_clicked);
+ });
+
+ document.addEventListener('change', (e) => {
+ if ( !e.target.classList.contains('icedeb-option') )
+ return;
+
+ save_settings();
+ });
+
+ get_clipboard_contents();
});