Commit 05352521 authored by Leo Iannacone's avatar Leo Iannacone

use var on declaration to prevent uncontrolled beahaviour

parent 697053ac
...@@ -6,7 +6,7 @@ function Page_Distrubion() ...@@ -6,7 +6,7 @@ function Page_Distrubion()
function __check_hash_makes_sense() { function __check_hash_makes_sense() {
if (! window.location.hash) if (! window.location.hash)
window.location.pathname = '/' window.location.pathname = '/'
info = window.location.hash.split('/') var info = window.location.hash.split('/')
if (info.length == 2) if (info.length == 2)
window.location.hash = info[0] window.location.hash = info[0]
} }
...@@ -15,9 +15,9 @@ function Page_Distrubion() ...@@ -15,9 +15,9 @@ function Page_Distrubion()
set: function(data) { set: function(data) {
if (! data) if (! data)
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
label = '' var label = ''
if (Utils.check_data_file(data)) { if (Utils.check_data_file(data)) {
complete_name = data.package.orig_name + '.' + data.file.name var complete_name = data.package.orig_name + '.' + data.file.name
if (! data.file.path) if (! data.file.path)
data.file.path = PATHS.debomatic + '/' + data.distribution.name + '/pool/' + data.package.orig_name + '/' + complete_name data.file.path = PATHS.debomatic + '/' + data.distribution.name + '/pool/' + data.package.orig_name + '/' + complete_name
label = complete_name + ' \ label = complete_name + ' \
...@@ -39,7 +39,7 @@ function Page_Distrubion() ...@@ -39,7 +39,7 @@ function Page_Distrubion()
var packages = { var packages = {
set: function (data) { set: function (data) {
$('#packages ul').html('') $('#packages ul').html('')
tmp = data var tmp = data
tmp.file = null tmp.file = null
data.distribution.packages.forEach(function(p){ data.distribution.packages.forEach(function(p){
tmp.package = p tmp.package = p
...@@ -55,7 +55,7 @@ function Page_Distrubion() ...@@ -55,7 +55,7 @@ function Page_Distrubion()
if (! data) if (! data)
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
if (Utils.check_data_distribution(data)) { if (Utils.check_data_distribution(data)) {
new_data = {} var new_data = {}
new_data.distribution = data.distribution new_data.distribution = data.distribution
socket.emit("get_distribution_packages", new_data) socket.emit("get_distribution_packages", new_data)
} }
...@@ -76,16 +76,16 @@ function Page_Distrubion() ...@@ -76,16 +76,16 @@ function Page_Distrubion()
var files = { var files = {
set: function (data) { set: function (data) {
files.clean() files.clean()
tmp = data var tmp = data
if (data.package.files && data.package.files.length > 0) { if (data.package.files && data.package.files.length > 0) {
selected_file = Utils.check_data_file(data) selected_file = Utils.check_data_file(data)
data.package.files.forEach(function(f){ data.package.files.forEach(function(f){
tmp.file = f tmp.file = f
current_file = $('<li id="file-'+ f.orig_name +'"><a title="'+ f.orig_name +'" href="'+ Utils.from_data_to_hash(tmp) + '">' + f.name + '</a></li>') var html_file = $('<li id="file-'+ f.orig_name +'"><a title="'+ f.orig_name +'" href="'+ Utils.from_data_to_hash(tmp) + '">' + f.name + '</a></li>')
current_file.on("click", function(){ html_file.on("click", function(){
files.select(this) files.select(this)
}) })
$('#logs ul').append(file) $('#logs ul').append(html_file)
}) })
$('#logs').show() $('#logs').show()
select() select()
...@@ -119,7 +119,7 @@ function Page_Distrubion() ...@@ -119,7 +119,7 @@ function Page_Distrubion()
if (! data) if (! data)
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
if (Utils.check_data_package(data)) { if (Utils.check_data_package(data)) {
new_data = {} var new_data = {}
new_data.distribution = data.distribution new_data.distribution = data.distribution
new_data.package = data.package new_data.package = data.package
socket.emit("get_package_files_list", new_data) socket.emit("get_package_files_list", new_data)
...@@ -149,7 +149,7 @@ function Page_Distrubion() ...@@ -149,7 +149,7 @@ function Page_Distrubion()
$('#file').hide() $('#file').hide()
}, },
append: function(data) { append: function(data) {
new_html = $("#file pre").html() + data.file.new_content var new_html = $("#file pre").html() + data.file.new_content
$("#file pre").html(new_html) $("#file pre").html(new_html)
if (AUTOSCROLL) // scroll down if (AUTOSCROLL) // scroll down
...@@ -159,7 +159,7 @@ function Page_Distrubion() ...@@ -159,7 +159,7 @@ function Page_Distrubion()
if (! data) if (! data)
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
if (Utils.check_data_file(data)) { if (Utils.check_data_file(data)) {
new_data = {} var new_data = {}
new_data.distribution = data.distribution new_data.distribution = data.distribution
new_data.package = data.package new_data.package = data.package
new_data.file = data.file new_data.file = data.file
...@@ -174,9 +174,9 @@ function Page_Distrubion() ...@@ -174,9 +174,9 @@ function Page_Distrubion()
if (! hash ) if (! hash )
hash = window.location.hash hash = window.location.hash
hash = hash.replace('#', '') hash = hash.replace('#', '')
new_html = '<li><a href="/">home</a></li>' var new_html = '<li><a href="/">home</a></li>'
new_hash = '#' var new_hash = '#'
info = hash.split('/') var info = hash.split('/')
for (var i = 0; i < info.length ; i++) { for (var i = 0; i < info.length ; i++) {
new_hash += info[i] new_hash += info[i]
if (i == (info.length - 1)) if (i == (info.length - 1))
......
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