summaryrefslogtreecommitdiffstats
path: root/js/main.js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-08-31 16:44:15 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-01 00:31:38 +0200
commitf3195d57429ffadc8484448112548f2ec77aa5ac (patch)
tree19b42a391372fbece19b94181ec06079e0629845 /js/main.js
parent409c6d509a39b88bca33389665daa00da5dc5f59 (diff)
more cleanup
Diffstat (limited to 'js/main.js')
-rw-r--r--js/main.js62
1 files changed, 24 insertions, 38 deletions
diff --git a/js/main.js b/js/main.js
index 5ca0af58e..23955ae8e 100644
--- a/js/main.js
+++ b/js/main.js
@@ -14,20 +14,14 @@ var News = News || {};
$(document).ready(function(){
+ // config values
+ var menuUpdateIntervalMiliseconds = 200000;
+
// global object array for accessing instances
News.Objects = {};
- News.Objects.Menu = new News.Menu($('#view').hasClass('show_all'));
- News.Objects.Items = new News.Items();
-
+ News.Objects.Menu = new News.Menu(menuUpdateIntervalMiliseconds);
News.Objects.Menu.bindOn('#feeds > ul');
- // basic setup
- News.Feed.updateAll();
- var updateInterval = 200000; //how often the feeds should update (in msec)
- setInterval('News.Feed.updateAll()', updateInterval);
-
-
-
/* first run script begins */
$('#browsebtn_firstrun, #cloudbtn_firstrun, #importbtn_firstrun').hide();
@@ -60,41 +54,33 @@ $(document).ready(function(){
});
$('#view').click(function(){
- var term;
+ var data = {};
if($(this).hasClass('show_all')){
- term = 'unread';
+ data.show = 'unread';
$(this).addClass('show_unread').removeClass('show_all');
} else {
- term = 'all';
+ data.show = 'all';
$(this).addClass('show_all').removeClass('show_unread');
}
- News.Feed.filter(term);
- });
- // mark items whose title was hid under the top edge as read
- // when the bottom is reached, mark all items as read
- $('#feed_items').scroll(function(){
- var boxHeight = $(this).height();
- var scrollHeight = $(this).prop('scrollHeight');
- var scrolled = $(this).scrollTop() + boxHeight;
- var scrollArea = this;
- $(this).children('ul').children('.feed_item:not(.read)').each(function(){
- var item = this;
- var itemOffset = $(this).position().top;
- if(itemOffset <= 0 || scrolled >= scrollHeight){
- // wait and check if the item is still under the top edge
- setTimeout(function(){ markItemAsRead(scrollArea, item);}, 1000);
+ $.post(OC.filePath('news', 'ajax', 'usersettings.php'), data, function(jsondata){
+ if(jsondata.status == 'success'){
+ var showAll;
+ if(data.show === 'all'){
+ showAll = true;
+ } else {
+ showAll = false;
+ }
+ News.Objects.Menu.setShowAll(showAll);
+ } else {
+ OC.dialogs.alert(jsonData.data.message, t('news', 'Error'));
}
- })
-
- });
-
- $('#feed_items').scrollTop(0);
-
- $(document).keydown(function(e) {
- if ((e.keyCode || e.which) == 74) { // 'j' key shortcut
-
- }
+ });
});
+
+ $(document).click(function(event) {
+ $('#feedfoldermenu').hide();
+ });
});
+