1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/**
* ownCloud - News app
*
* @author Bernhard Posselt
* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
var News = News || {};
$(document).ready(function(){
// config values
var menuUpdateIntervalMiliseconds = 200000;
// global object array for accessing instances
News.Objects = {};
News.Objects.Items = new News.Items('#feed_items');
News.Objects.Menu = new News.Menu(menuUpdateIntervalMiliseconds, News.Objects.Items);
News.Objects.Menu.bindOn('#feeds > ul');
/* first run script begins */
$('#browsebtn_firstrun, #cloudbtn_firstrun, #importbtn_firstrun').hide();
/* first run script ends */
$('#addfeed').click(function() {
News.UI.overview('#addfeed_dialog','feeddialog.php');
});
$('#addfeedbtn').click(function() {
$(this).hide();
$('#addfeed_dialog_firstrun').show();
});
$('#addfolder').click(function() {
News.UI.overview('#addfolder_dialog','folderdialog.php');
});
$('#addfeedfolder').click(function(event) {
News.DropDownMenu.fade($(this).children('ul'));
event.stopPropagation();
});
$('#settingsbtn').on('click keydown', function() {
try {
OC.appSettings({appid:'news', loadJS:true, cache:false});
} catch(e) {
alert(e);
}
});
$('#view').click(function(){
var data = {};
if($(this).hasClass('show_all')){
data.show = 'unread';
$(this).addClass('show_unread').removeClass('show_all');
} else {
data.show = 'all';
$(this).addClass('show_all').removeClass('show_unread');
}
$.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'));
}
});
});
$(document).click(function(event) {
$('#feedfoldermenu').hide();
});
$(document).keydown(function(e) {
if ((e.keyCode || e.which) == 74) { // 'j' key shortcut
}
});
});
|