Browse Source

Resets whitespace changes in script.js

pull/135/head
taylor 4 years ago
parent
commit
99fd654e4b
  1. 37
      public/js/script.js

37
public/js/script.js

@ -1,8 +1,9 @@
function tz_seconds_to_offset(seconds) {
var tz_offset = "";
var tz_offset = '';
var hours = zero_pad(Math.abs(seconds / 60 / 60));
var minutes = zero_pad(Math.floor(seconds / 60) % 60);
return (seconds < 0 ? "-" : "+") + hours + ":" + minutes;
return (seconds < 0 ? '-' : '+') + hours + ":" + minutes;
}
function zero_pad(num) {
@ -14,41 +15,25 @@ function zero_pad(num) {
}
function tokenfieldToArray(sel) {
return $(sel)
.tokenfield("getTokens")
.map(function (t) {
return t.value;
});
return $(sel).tokenfield("getTokens").map(function(t){ return t.value});
}
$(function(){
// Set the date from JS
var d = new Date();
$("#note_date").val(
d.getFullYear() +
"-" +
zero_pad(d.getMonth() + 1) +
"-" +
zero_pad(d.getDate())
);
$("#note_time").val(
zero_pad(d.getHours()) +
":" +
zero_pad(d.getMinutes()) +
":" +
zero_pad(d.getSeconds())
);
$("#note_tzoffset").val(
tz_seconds_to_offset(d.getTimezoneOffset() * 60 * -1)
);
$("#note_date").val(d.getFullYear()+"-"+zero_pad(d.getMonth()+1)+"-"+zero_pad(d.getDate()));
$("#note_time").val(zero_pad(d.getHours())+":"+zero_pad(d.getMinutes())+":"+zero_pad(d.getSeconds()));
$("#note_tzoffset").val(tz_seconds_to_offset(d.getTimezoneOffset() * 60 * -1));
// ctrl-s to save
$(window).on("keydown", function (e) {
$(window).on('keydown', function(e){
if(e.keyCode == 83 && e.ctrlKey){
$("#btn_post").click();
}
});
});
})
function auto_prefix_url_field(field) {
var str = field.value;

Loading…
Cancel
Save