Commit 8567dd74 authored by Leo Iannacone's avatar Leo Iannacone

we do not really need to wait window.on('load') event because scripts are...

we do not really need to wait window.on('load') event because scripts are located on the pottom of layout.ejs, so when they run html is already loaded - removed
parent 11b20007
......@@ -508,37 +508,35 @@ function Page_Distrubion(socket)
debug(1, "changing view", "old:", old_view, "new:", new_view)
});
$(window).on('load', function () {
if (! __check_hash_makes_sense())
return
populate()
// Init sticky-package back_on_top on click
$("#sticky-package").on("click", function(){
$('html').animate({scrollTop: 0}, 100);
})
// WORKAROUND:
// when page is loaded sidebar has offset().top
// equals 0. This is because html is loaded on socket
// events. Sleep a while and call stiky.reset()
this.setTimeout(sticky.reset, 500);
// WORKAROUND:
// On incoming hundred of lines browser goes crazy.
// Append lines every 200 mills.
function watch_for_new_lines() {
if (new_lines.length > 0) {
file.append(new_lines.join(''))
new_lines = []
}
setTimeout(watch_for_new_lines, 200);
if (! __check_hash_makes_sense())
return
populate()
// Init sticky-package back_on_top on click
$("#sticky-package").on("click", function(){
$('html').animate({scrollTop: 0}, 100);
})
// WORKAROUND:
// when page is loaded sidebar has offset().top
// equals 0. This is because html is loaded on socket
// events. Sleep a while and call stiky.reset()
setTimeout(sticky.reset, 500);
// WORKAROUND:
// On incoming hundred of lines browser goes crazy.
// Append lines every 200 mills.
function watch_for_new_lines() {
if (new_lines.length > 0) {
file.append(new_lines.join(''))
new_lines = []
}
watch_for_new_lines()
setTimeout(watch_for_new_lines, 200);
}
watch_for_new_lines()
// Update html according with preferences
preferences()
});
}
// Update html according with preferences
preferences()
}
}
......@@ -22,32 +22,28 @@ function Preferences() {
// init prefence page
this.initPage = function() {
$(window).on('load', function() {
// set view according with config.preferences
for (key in config.preferences) {
var element = $("#preferences #" + key)
if (element.attr('type') == "checkbox") {
element.prop('checked', config.preferences[key])
}
else {
element.val(config.preferences[key])
}
// set view according with config.preferences
for (key in config.preferences) {
var element = $("#preferences #" + key)
if (element.attr('type') == "checkbox") {
element.prop('checked', config.preferences[key])
}
else {
element.val(config.preferences[key])
}
}
// on input change, set prefence
$("#preferences input, #preferences select").change(function() {
var key = $(this).attr('id')
var value = $(this).val()
if ($(this).attr('type') == 'checkbox')
value = $(this).is(':checked')
set(key,value)
// give to user an immediate feedback on show header
if (key == "header") {
page_generic.header()
}
})
// on input change, set prefence
$("#preferences input, #preferences select").change(function() {
var key = $(this).attr('id')
var value = $(this).val()
if ($(this).attr('type') == 'checkbox')
value = $(this).is(':checked')
set(key,value)
// give to user an immediate feedback on show header
if (key == "header") {
page_generic.header()
}
})
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment