Commit 2f3adf58 authored by Leo Iannacone's avatar Leo Iannacone

renamed Page to Page_Distribution

parent 6550b051
...@@ -33,35 +33,35 @@ var socket = io.connect('//localhost:3000'); ...@@ -33,35 +33,35 @@ var socket = io.connect('//localhost:3000');
var old_data = Utils.from_hash_to_data() var old_data = Utils.from_hash_to_data()
socket.on('distributions', function(distributions) { socket.on('distributions', function(distributions) {
Page.navbar.update(distributions) Page_Distrubion.navbar.update(distributions)
}); });
socket.on('distribution_packages', function(data){ socket.on('distribution_packages', function(data){
Page.packages.set(data) Page_Distrubion.packages.set(data)
}) })
socket.on('package_file_list', function(data){ socket.on('package_file_list', function(data){
Page.files.set(data) Page_Distrubion.files.set(data)
}) })
socket.on('file', function (data) { socket.on('file', function (data) {
Page.file.set(data) Page_Distrubion.file.set(data)
}) })
socket.on('file_newcontent', function(data) { socket.on('file_newcontent', function(data) {
Page.file.append(data) Page_Distrubion.file.append(data)
}) })
socket.on('error', function() { console.error(arguments) }); socket.on('error', function() { console.error(arguments) });
$(window).on('hashchange', function() { $(window).on('hashchange', function() {
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
Page.update(data, old_data) Page_Distrubion.update(data, old_data)
old_data = data old_data = data
}); });
$(window).on('load', function (){ $(window).on('load', function (){
Page.update(old_data) Page_Distrubion.update(old_data)
$(window).scroll(function() { $(window).scroll(function() {
var offset = $("#file").offset(); var offset = $("#file").offset();
if ($(window).scrollTop() > offset.top + 220) { if ($(window).scrollTop() > offset.top + 220) {
...@@ -71,5 +71,4 @@ $(window).on('load', function (){ ...@@ -71,5 +71,4 @@ $(window).on('load', function (){
$("#sticky").stop().removeClass('fixed'); $("#sticky").stop().removeClass('fixed');
} }
}); });
}); });
var Page = { var Page_Distrubion = {
title: { title: {
set: function(data) { set: function(data) {
...@@ -27,7 +27,7 @@ var Page = { ...@@ -27,7 +27,7 @@ var Page = {
tmp.package = p tmp.package = p
$('#packages ul').append('<li id="package-' + p.orig_name + '"><a href="' + Utils.from_data_to_hash(tmp) + '">'+ p.name + ' <span>'+p.version+'</span></a></li>') $('#packages ul').append('<li id="package-' + p.orig_name + '"><a href="' + Utils.from_data_to_hash(tmp) + '">'+ p.name + ' <span>'+p.version+'</span></a></li>')
}) })
Page.select() Page_Distrubion.select()
}, },
clean: function () { clean: function () {
...@@ -43,7 +43,7 @@ var Page = { ...@@ -43,7 +43,7 @@ var Page = {
files: { files: {
set: function (data) { set: function (data) {
Page.files.clean() Page_Distrubion.files.clean()
tmp = data tmp = data
if (data.package.files) { if (data.package.files) {
selected_file = Utils.check_data_file(data) selected_file = Utils.check_data_file(data)
...@@ -51,12 +51,12 @@ var Page = { ...@@ -51,12 +51,12 @@ var Page = {
tmp.file = f tmp.file = f
file = $('<li id="file-'+ f.orig_name +'"><a title="'+ f.orig_name +'" href="'+ Utils.from_data_to_hash(tmp) + '">' + f.name + '</a></li>') file = $('<li id="file-'+ f.orig_name +'"><a title="'+ f.orig_name +'" href="'+ Utils.from_data_to_hash(tmp) + '">' + f.name + '</a></li>')
file.on("click", function(){ file.on("click", function(){
Page.files.select(this) Page_Distrubion.files.select(this)
}) })
$('#logs ul').append(file) $('#logs ul').append(file)
}) })
$('#logs').show() $('#logs').show()
Page.select() Page_Distrubion.select()
} }
if (data.package.debs) { if (data.package.debs) {
...@@ -99,7 +99,7 @@ var Page = { ...@@ -99,7 +99,7 @@ var Page = {
set: function(data) { set: function(data) {
$("#file pre").html(data.file.content) $("#file pre").html(data.file.content)
$("#file").show() $("#file").show()
Page.select() Page_Distrubion.select()
}, },
clean: function() { clean: function() {
$('#file pre').html('') $('#file pre').html('')
...@@ -168,20 +168,20 @@ var Page = { ...@@ -168,20 +168,20 @@ var Page = {
}, },
clean: function() { clean: function() {
Page.title.clean() Page_Distrubion.title.clean()
Page.packages.clean() Page_Distrubion.packages.clean()
Page.files.clean() Page_Distrubion.files.clean()
Page.file.clean() Page_Distrubion.file.clean()
Page.select() Page_Distrubion.select()
Page.breadcrumb.update() Page_Distrubion.breadcrumb.update()
}, },
update: function(data, old_data) { update: function(data, old_data) {
if (! old_data ) { if (! old_data ) {
if (! data ) if (! data )
Page.populate() Page_Distrubion.populate()
else else
Page.populate(data) Page_Distrubion.populate(data)
return; return;
} }
else { else {
...@@ -189,16 +189,16 @@ var Page = { ...@@ -189,16 +189,16 @@ var Page = {
! Utils.check_data_distribution(data) || ! Utils.check_data_distribution(data) ||
data.distribution.name != old_data.distribution.name) data.distribution.name != old_data.distribution.name)
{ {
Page.clean() Page_Distrubion.clean()
Page.populate(data) Page_Distrubion.populate(data)
} }
else if ( else if (
! Utils.check_data_package(old_data) || ! Utils.check_data_package(old_data) ||
! Utils.check_data_package(data) || ! Utils.check_data_package(data) ||
data.package.orig_name != old_data.package.orig_name ) data.package.orig_name != old_data.package.orig_name )
{ {
Page.file.clean() Page_Distrubion.file.clean()
Page.files.get(data) Page_Distrubion.files.get(data)
// I will always get dataestamp from package // I will always get dataestamp from package
window.location.hash += '/datestamp' window.location.hash += '/datestamp'
} }
...@@ -208,23 +208,23 @@ var Page = { ...@@ -208,23 +208,23 @@ var Page = {
data.file.name != old_data.file.name data.file.name != old_data.file.name
) )
{ {
Page.file.get() Page_Distrubion.file.get()
} }
Page.title.set(data) Page_Distrubion.title.set(data)
Page.breadcrumb.update() Page_Distrubion.breadcrumb.update()
Page.select(data) Page_Distrubion.select(data)
} }
}, },
populate: function (data) { populate: function (data) {
Page.clean() Page_Distrubion.clean()
if (! data ) if (! data )
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
Page.packages.get(data) Page_Distrubion.packages.get(data)
Page.files.get(data) Page_Distrubion.files.get(data)
Page.file.get(data) Page_Distrubion.file.get(data)
Page.select(data) Page_Distrubion.select(data)
Page.breadcrumb.update() Page_Distrubion.breadcrumb.update()
Page.title.set(data) Page_Distrubion.title.set(data)
} }
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<script src="/libs/bootstrap/3.1.1/js/bootstrap.min.js"></script> <script src="/libs/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src='/javascripts/utils.js'></script> <script src='/javascripts/utils.js'></script>
<script src='/javascripts/page.js'></script> <script src='/javascripts/page_distribution.js'></script>
<script src='/javascripts/main.js'></script> <script src='/javascripts/main.js'></script>
</head> </head>
<body> <body>
......
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