-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
76 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
startTime(); | ||
|
||
function startTime(){ | ||
var date = new Date(); | ||
|
||
var hour = date.getHours(); | ||
var minute = date.getMinutes(); | ||
var second = date.getSeconds(); | ||
var suffix = ""; | ||
|
||
//12-hour clock support :) | ||
if(settings['clockStyle'] == "1"){ | ||
if(hour > 12){ | ||
suffix = "p.m."; | ||
hour = hour - 12; | ||
}else{ | ||
suffix = "a.m."; | ||
} | ||
} | ||
|
||
//Add "0" before minutes, if minute is smaller than 10 | ||
if(minute < 10){ | ||
minute = "0" + minute; | ||
} | ||
|
||
//Add "0" before seconds, if seconds is smaller than 10 | ||
if(second < 10){ | ||
second = "0" + second; | ||
} | ||
|
||
$("#clock").html(hour + ":" + minute + ":" + second); | ||
//Update clock! | ||
$("#clock").html(hour + ":" + minute + ":" + second + " " + suffix); | ||
} | ||
|
||
setInterval(startTime, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,50 @@ | ||
var settings = {}; | ||
load_settings(); | ||
|
||
//settings-backgroundPath | ||
function save_settings(){ | ||
localStorage.setItem("settings.language", $("#language").val()); | ||
localStorage.setItem("settings.layout", $("#layout").val()); | ||
localStorage.setItem("settings.background", $("#background").val()); | ||
localStorage.setItem("settings.language", $("#settings-language").val()); | ||
localStorage.setItem("settings.background", $("#settings-background").val()); | ||
localStorage.setItem("settings.backgroundPath", $("#settings-backgroundPath").val()); | ||
localStorage.setItem("settings.clockStyle", $("#settings-clockStyle").val()); | ||
load_settings(); | ||
} | ||
|
||
function load_settings(){ | ||
set_default_settings(); | ||
settings['language'] = localStorage.getItem("settings.language"); | ||
settings['layout'] = localStorage.getItem("settings.layout"); | ||
settings['background'] = localStorage.getItem("settings.background"); | ||
settings['backgroundPath'] = localStorage.getItem("settings.backgroundPath"); | ||
settings['clockStyle'] = localStorage.getItem("settings.clockStyle"); | ||
set_default_settings(); | ||
|
||
//Update background | ||
$("body").css("background-image", "url(\"assets/ui/background-" + settings['background'] + ".jpg\")"); | ||
if(settings['background'] == "custom"){ | ||
if(settings['backgroundPath'] != ""){ | ||
$("body").css("background-image", "url(\"" + settings['backgroundPath'] + "\")"); | ||
}else{ | ||
$("body").css("background-image", "url(\"assets/ui/background/background-blue.jpg\")"); | ||
} | ||
}else{ | ||
$("body").css("background-image", "url(\"assets/ui/background/background-" + settings['background'] + ".jpg\")"); | ||
$("#settings-backgroundPath").val(""); | ||
} | ||
} | ||
|
||
function set_default_settings(){ | ||
if(localStorage.getItem("settings.language") == null || localStorage.getItem("settings.language") == ""){ | ||
localStorage.setItem("settings.language", $("#language").val()); | ||
} | ||
if(localStorage.getItem("settings.layout") == null || localStorage.getItem("settings.layout") == ""){ | ||
localStorage.setItem("settings.layout", "en"); | ||
if(localStorage.getItem("settings.language") == null || localStorage.getItem("settings.language") == "" || !localStorage.getItem("settings.language")){ | ||
localStorage.setItem("settings.language", $("#settings-language").val()); | ||
} | ||
if(localStorage.getItem("settings.background") == null){ | ||
if(localStorage.getItem("settings.background") == null || !localStorage.getItem("settings.background")){ | ||
localStorage.setItem("settings.background", "blue"); | ||
} | ||
if(localStorage.getItem("settings.clockStyle") == null || localStorage.getItem("settings.clockStyle") == "" || !localStorage.getItem("settings.clockStyle")){ | ||
localStorage.setItem("settings.clockStyle", "0"); | ||
} | ||
} | ||
|
||
function settings_fill_inputs(){ | ||
$("#language").val(settings['language']); | ||
$("#layout").val(settings['layout']); | ||
$("#background").val(settings['background']); | ||
} | ||
|
||
/* | ||
var settings = (function ($) { | ||
var $settings_card = $('#settings'); | ||
var $signin_card = $('#login'); | ||
var animation_time = 500; //in miliseconds | ||
window.login_settings = window.login_settings || {}; | ||
var setup_settings_bind = function () { | ||
$('#action-settings, #settings .cancel').on( | ||
'click', | ||
function (e) { | ||
e.preventDefault(); | ||
if($settings_card.is(':hidden')){ | ||
show_settings_form(); | ||
}else{ | ||
hide_settings_form(); | ||
} | ||
} | ||
); | ||
}; | ||
var show_settings_form = function(){ | ||
$signin_card.fadeOut(animation_time, function(){ | ||
$settings_card.fadeIn(animation_time); | ||
load_settings_from_localstorage(); | ||
}); | ||
}; | ||
var hide_settings_form = function(){ | ||
$settings_card.fadeOut(animation_time, function(){ | ||
$signin_card.fadeIn(animation_time); | ||
}); | ||
}; | ||
var load_settings_from_localstorage = function () { | ||
var formdata = localStorage.getItem('login_settings'); | ||
formdata = JSON.parse(formdata); | ||
if(formdata) { | ||
$.each(formdata, function(index, data) { | ||
console.log(data.name, data.value); | ||
$('#'+data.name).val(data.value); | ||
}); | ||
} | ||
assign_stored_settings(); | ||
check_stored_settings(); | ||
}; | ||
var save_settings_to_localstorage = function ($form) { | ||
var formdata = $form.serializeArray(); | ||
formdata = JSON.stringify(formdata); | ||
localStorage.setItem('login_settings', formdata); | ||
assign_stored_settings(); | ||
check_stored_settings(); | ||
}; | ||
var assign_stored_settings = function () { | ||
var stored_setings = JSON.parse( | ||
localStorage.getItem('login_settings') | ||
); | ||
if(stored_setings) { | ||
$.each(stored_setings, function(index, data) { | ||
window.login_settings[data.name] = data.value; | ||
}); | ||
} | ||
}; | ||
var check_stored_settings = function () { | ||
if (window.login_settings['show_photo'] == 0) { | ||
$('.profile-img').hide(); | ||
} else { | ||
$('.profile-img').show(); | ||
} | ||
}; | ||
// exposed outside of closure | ||
var init = function () { | ||
$(function () { | ||
setup_settings_bind(); | ||
assign_stored_settings(); | ||
check_stored_settings(); | ||
$settings_card.find('form').on('submit', function(e) { | ||
e.preventDefault(); | ||
save_settings_to_localstorage($settings_card); | ||
hide_settings_form(); | ||
}); | ||
}); | ||
}; | ||
return { | ||
init: init | ||
}; | ||
} (jQuery)); | ||
settings.init(); | ||
*/ | ||
$("#settings-language").val(settings['language']); | ||
$("#settings-background").val(settings['background']); | ||
$("#settings-backgroundPath").val(settings['backgroundPath']); | ||
$("#settings-clockStyle").val(settings['clockStyle']); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters