forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-26 13:21:33 +02:00
parent e1568fc728
commit de9accfe88
1 changed files with 19 additions and 19 deletions

View File

@ -157,36 +157,36 @@
}; };
// Run AutoSuggestTitle function on load // // Run AutoSuggestTitle function on load
if (window.location.pathname=='/submit') { // if (window.location.pathname=='/submit') {
window.onload = autoSuggestTitle(); // window.onload = autoSuggestTitle();
} // }
// Paste to create submission // // Paste to create submission
document.addEventListener('paste', function (event) { // document.addEventListener('paste', function (event) {
var nothingFocused = document.activeElement === document.body; // var nothingFocused = document.activeElement === document.body;
if (nothingFocused) { // if (nothingFocused) {
var clipText = event.clipboardData.getData('Text'); // var clipText = event.clipboardData.getData('Text');
var url = new RegExp('^(?:[a-z]+:)?//', 'i'); // var url = new RegExp('^(?:[a-z]+:)?//', 'i');
if (url.test(clipText) && window.location.pathname !== '/submit') { // if (url.test(clipText) && window.location.pathname !== '/submit') {
window.location.href = '/submit?url=' + clipText; // window.location.href = '/submit?url=' + clipText;
} // }
else if (url.test(clipText) && window.location.pathname == '/submit') { // else if (url.test(clipText) && window.location.pathname == '/submit') {
document.getElementById("post-URL").value = clipText; // document.getElementById("post-URL").value = clipText;
autoSuggestTitle() // autoSuggestTitle()
} // }
} // }
}); // });
// Submit Page Front-end Validation // Submit Page Front-end Validation