Skip to content

Commit

Permalink
Delete the moment.js lib
Browse files Browse the repository at this point in the history
  • Loading branch information
evdokimovm committed Apr 19, 2022
1 parent 8e3302d commit a9549ee
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
24 changes: 20 additions & 4 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ function copy() {
document.execCommand("copy")
}

function getDate() {
var date = new Date()
var options = {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
year: 'numeric',
month: 'short',
day: 'numeric'
}
var _date = date.toLocaleTimeString('default', options)

return _date
}

function linkPreview() {
var links = ''
var link_text = document.querySelector('textarea').value
Expand Down Expand Up @@ -163,7 +179,7 @@ readTabs()
fillSelectBox()
showFiles()
document.querySelector(".copy").addEventListener("click", copy)
$('input[name=filename]').val(moment().format('DD MMM YYYY, h:mm a'))
$('input[name=filename]').val(getDate())

document.querySelector('button.opentabs').addEventListener('click', function () {
var lines = $('textarea').val().split('\n')
Expand Down Expand Up @@ -209,7 +225,7 @@ document.querySelector('button.export_file').addEventListener('click', function

chrome.downloads.download({
url: url,
filename: (_filename.value.replace(':', ' ')) + '.json'
filename: (_filename.value.replaceAll(':', ' ')) + '.json'
})
}
}
Expand Down Expand Up @@ -246,8 +262,8 @@ document.querySelector('button.import_all_files').addEventListener('click', asyn

$('.save').on('click', function () {
var file_obj = {}
file_obj.id = moment().format('x')
file_obj.time = moment().format('DD MMM YYYY, h:mm a')
file_obj.id = String(+ new Date())
file_obj.time = getDate()
file_obj.links = $('textarea').val()

if ($('input[name=filename]').val() == "") {
Expand Down
7 changes: 0 additions & 7 deletions js/vendor/moment.min.js

This file was deleted.

3 changes: 1 addition & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
{
"js": [
"js/vendor/jquery-2.2.4.min.js",
"js/vendor/is.min.js",
"js/vendor/moment.min.js"
"js/vendor/is.min.js"
],
"matches": [
"*://*/*"
Expand Down
1 change: 0 additions & 1 deletion options.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ <h5 class="pull-left">FILES</h5><button class="btn btn-xs delete_files pull-righ
</div>
<script src="js/vendor/jquery-2.2.4.min.js"></script>
<script src="js/vendor/is.min.js"></script>
<script src="js/vendor/moment.min.js"></script>
<script src="js/options.js"></script>
</body>

Expand Down

0 comments on commit a9549ee

Please sign in to comment.