@ -21,108 +21,92 @@ function activeFeedIsCat() {
}
}
function getActiveFeedId ( ) {
function getActiveFeedId ( ) {
try {
return _active _feed _id ;
return _active _feed _id ;
} catch ( e ) {
exception _error ( "getActiveFeedId" , e ) ;
}
}
}
function setActiveFeedId ( id , is _cat ) {
function setActiveFeedId ( id , is _cat ) {
try {
hash _set ( 'f' , id ) ;
hash _set ( 'f' , id ) ;
hash _set ( 'c' , is _cat ? 1 : 0 ) ;
hash _set ( 'c' , is _cat ? 1 : 0 ) ;
_active _feed _id = id ;
_active _feed _id = id ;
_active _feed _is _cat = is _cat ;
_active _feed _is _cat = is _cat ;
$ ( "headlines-frame" ) . setAttribute ( "feed-id" , id ) ;
$ ( "headlines-frame" ) . setAttribute ( "feed-id" , id ) ;
$ ( "headlines-frame" ) . setAttribute ( "is-cat" , is _cat ? 1 : 0 ) ;
$ ( "headlines-frame" ) . setAttribute ( "is-cat" , is _cat ? 1 : 0 ) ;
selectFeed ( id , is _cat ) ;
selectFeed ( id , is _cat ) ;
PluginHost . run ( PluginHost . HOOK _FEED _SET _ACTIVE , _active _article _id ) ;
PluginHost . run ( PluginHost . HOOK _FEED _SET _ACTIVE , _active _article _id ) ;
} catch ( e ) {
exception _error ( "setActiveFeedId" , e ) ;
}
}
}
function updateFeedList ( ) {
function updateFeedList ( ) {
try {
// $("feeds-holder").innerHTML = "<div id=\"feedlistLoading\">" +
Element . show ( "feedlistLoading" ) ;
// __("Loading, please wait...") + "</div>";
Element . show ( "feedlistLoading" ) ;
resetCounterCache ( ) ;
resetCounterCache ( ) ;
if ( dijit . byId ( "feedTree" ) ) {
if ( dijit . byId ( "feedTree" ) ) {
dijit . byId ( "feedTree" ) . destroyRecursive ( ) ;
dijit . byId ( "feedTree" ) . destroyRecursive ( ) ;
}
}
var store = new dojo . data . ItemFileWriteStore ( {
var store = new dojo . data . ItemFileWriteStore ( {
url : "backend.php?op=pref_feeds&method=getfeedtree&mode=2" } ) ;
url : "backend.php?op=pref_feeds&method=getfeedtree&mode=2" } ) ;
var treeModel = new fox . FeedStoreModel ( {
var treeModel = new fox . FeedStoreModel ( {
store : store ,
store : store ,
query : {
query : {
"type" : getInitParam ( 'enable_feed_cats' ) == 1 ? "category" : "feed"
"type" : getInitParam ( 'enable_feed_cats' ) == 1 ? "category" : "feed"
} ,
rootId : "root" ,
rootLabel : "Feeds" ,
childrenAttrs : [ "items" ]
} ) ;
var tree = new fox . FeedTree ( {
model : treeModel ,
onClick : function ( item , node ) {
var id = String ( item . id ) ;
var is _cat = id . match ( "^CAT:" ) ;
var feed = id . substr ( id . indexOf ( ":" ) + 1 ) ;
viewfeed ( { feed : feed , is _cat : is _cat } ) ;
return false ;
} ,
} ,
openOnClick : false ,
rootId : "root" ,
showRoot : false ,
rootLabel : "Feeds" ,
persist : true ,
childrenAttrs : [ "items" ]
id : "feedTree" ,
} ) ;
} , "feedTree" ) ;
var tree = new fox . FeedTree ( {
model : treeModel ,
onClick : function ( item , node ) {
var id = String ( item . id ) ;
var is _cat = id . match ( "^CAT:" ) ;
var feed = id . substr ( id . indexOf ( ":" ) + 1 ) ;
viewfeed ( { feed : feed , is _cat : is _cat } ) ;
return false ;
} ,
openOnClick : false ,
showRoot : false ,
persist : true ,
id : "feedTree" ,
} , "feedTree" ) ;
/ * v a r m e n u = n e w d i j i t . M e n u ( { i d : ' f e e d M e n u ' } ) ;
/ * v a r m e n u = n e w d i j i t . M e n u ( { i d : ' f e e d M e n u ' } ) ;
menu . addChild ( new dijit . MenuItem ( {
menu . addChild ( new dijit . MenuItem ( {
label : "Simple menu item"
label : "Simple menu item"
} ) ) ;
} ) ) ;
// menu.bindDomNode(tree.domNode); */
// menu.bindDomNode(tree.domNode); */
var tmph = dojo . connect ( dijit . byId ( 'feedMenu' ) , '_openMyself' , function ( event ) {
var tmph = dojo . connect ( dijit . byId ( 'feedMenu' ) , '_openMyself' , function ( event ) {
console . log ( dijit . getEnclosingWidget ( event . target ) ) ;
console . log ( dijit . getEnclosingWidget ( event . target ) ) ;
dojo . disconnect ( tmph ) ;
dojo . disconnect ( tmph ) ;
} ) ;
} ) ;
$ ( "feeds-holder" ) . appendChild ( tree . domNode ) ;
$ ( "feeds-holder" ) . appendChild ( tree . domNode ) ;
var tmph = dojo . connect ( tree , 'onLoad' , function ( ) {
var tmph = dojo . connect ( tree , 'onLoad' , function ( ) {
dojo . disconnect ( tmph ) ;
dojo . disconnect ( tmph ) ;
Element . hide ( "feedlistLoading" ) ;
Element . hide ( "feedlistLoading" ) ;
try {
feedlist _init ( ) ;
feedlist _init ( ) ;
// var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
// menu.bindDomNode(node);
loading _set _progress ( 25 ) ;
loading _set _progress ( 25 ) ;
} ) ;
} catch ( e ) {
exception _error ( e ) ;
tree . startup ( ) ;
}
} ) ;
} catch ( e ) {
tree . startup ( ) ;
exception _error ( "updateFeedList" , e ) ;
}
}
}
function catchupAllFeeds ( ) {
function catchupAllFeeds ( ) {
@ -218,46 +202,49 @@ function genericSanityCheck() {
function init ( ) {
function init ( ) {
try {
//dojo.registerModulePath("fox", "../../js/");
require ( [ "dojo/_base/kernel" ,
"dojo/ready" ,
"dojo/parser" ,
"dojo/_base/loader" ,
"dojo/_base/html" ,
"dojo/query" ,
"dijit/ProgressBar" ,
"dijit/ColorPalette" ,
"dijit/Dialog" ,
"dijit/form/Button" ,
"dijit/form/ComboButton" ,
"dijit/form/CheckBox" ,
"dijit/form/DropDownButton" ,
"dijit/form/FilteringSelect" ,
"dijit/form/Form" ,
"dijit/form/RadioButton" ,
"dijit/form/Select" ,
"dijit/form/SimpleTextarea" ,
"dijit/form/TextBox" ,
"dijit/form/ComboBox" ,
"dijit/form/ValidationTextBox" ,
"dijit/InlineEditBox" ,
"dijit/layout/AccordionContainer" ,
"dijit/layout/BorderContainer" ,
"dijit/layout/ContentPane" ,
"dijit/layout/TabContainer" ,
"dijit/PopupMenuItem" ,
"dijit/Menu" ,
"dijit/Toolbar" ,
"dijit/Tree" ,
"dijit/tree/dndSource" ,
"dijit/tree/ForestStoreModel" ,
"dojo/data/ItemFileWriteStore" ,
"fox/FeedTree" ] , function ( dojo , ready , parser ) {
ready ( function ( ) {
window . onerror = function ( message , filename , lineno , colno , error ) {
report _error ( message , filename , lineno , colno , error ) ;
} ;
require ( [ "dojo/_base/kernel" ,
"dojo/ready" ,
"dojo/parser" ,
"dojo/_base/loader" ,
"dojo/_base/html" ,
"dojo/query" ,
"dijit/ProgressBar" ,
"dijit/ColorPalette" ,
"dijit/Dialog" ,
"dijit/form/Button" ,
"dijit/form/ComboButton" ,
"dijit/form/CheckBox" ,
"dijit/form/DropDownButton" ,
"dijit/form/FilteringSelect" ,
"dijit/form/Form" ,
"dijit/form/RadioButton" ,
"dijit/form/Select" ,
"dijit/form/SimpleTextarea" ,
"dijit/form/TextBox" ,
"dijit/form/ComboBox" ,
"dijit/form/ValidationTextBox" ,
"dijit/InlineEditBox" ,
"dijit/layout/AccordionContainer" ,
"dijit/layout/BorderContainer" ,
"dijit/layout/ContentPane" ,
"dijit/layout/TabContainer" ,
"dijit/PopupMenuItem" ,
"dijit/Menu" ,
"dijit/Toolbar" ,
"dijit/Tree" ,
"dijit/tree/dndSource" ,
"dijit/tree/ForestStoreModel" ,
"dojo/data/ItemFileWriteStore" ,
"fox/FeedTree" ] , function ( dojo , ready , parser ) {
ready ( function ( ) {
try {
parser . parse ( ) ;
parser . parse ( ) ;
if ( ! genericSanityCheck ( ) )
if ( ! genericSanityCheck ( ) )
@ -274,24 +261,25 @@ function init() {
init _hotkey _actions ( ) ;
init _hotkey _actions ( ) ;
new Ajax . Request ( "backend.php" , {
new Ajax . Request ( "backend.php" , {
parameters : { op : "rpc" , method : "sanityCheck" , hasAudio : hasAudio ,
parameters : {
op : "rpc" , method : "sanityCheck" , hasAudio : hasAudio ,
hasMp3 : hasMp3 ,
hasMp3 : hasMp3 ,
clientTzOffset : clientTzOffset ,
clientTzOffset : clientTzOffset ,
hasSandbox : hasSandbox } ,
hasSandbox : hasSandbox
onComplete : function ( transport ) {
} ,
onComplete : function ( transport ) {
backend _sanity _check _callback ( transport ) ;
backend _sanity _check _callback ( transport ) ;
} } ) ;
}
} ) ;
} catch ( e ) {
} ) ;
exception _error ( e ) ;
}
} ) ;
} ) ;
} catch ( e ) {
} ) ;
exception _error ( "init" , e ) ;
}
}
}
function init _hotkey _actions ( ) {
function init _hotkey _actions ( ) {
@ -587,192 +575,177 @@ function init_hotkey_actions() {
}
}
function init _second _stage ( ) {
function init _second _stage ( ) {
updateFeedList ( ) ;
closeArticlePanel ( ) ;
try {
if ( parseInt ( getCookie ( "ttrss_fh_width" ) ) > 0 ) {
updateFeedList ( ) ;
dijit . byId ( "feeds-holder" ) . domNode . setStyle (
closeArticlePanel ( ) ;
{ width : getCookie ( "ttrss_fh_width" ) + "px" } ) ;
}
if ( parseInt ( getCookie ( "ttrss_fh_width" ) ) > 0 ) {
dijit . byId ( "feeds-holder" ) . domNode . setStyle (
{ width : getCookie ( "ttrss_fh_width" ) + "px" } ) ;
}
dijit . byId ( "main" ) . resize ( ) ;
var tmph = dojo . connect ( dijit . byId ( 'feeds-holder' ) , 'resize' ,
dijit . byId ( "main" ) . resize ( ) ;
function ( args ) {
if ( args && args . w >= 0 ) {
setCookie ( "ttrss_fh_width" , args . w , getInitParam ( "cookie_lifetime" ) ) ;
}
} ) ;
var tmph = dojo . connect ( dijit . byId ( 'content-insert' ) , 'resize' ,
var tmph = dojo . connect ( dijit . byId ( 'feeds-holder' ) , 'resize' ,
function ( args ) {
function ( args ) {
if ( args && args . w >= 0 && args . h >= 0 ) {
if ( args && args . w >= 0 ) {
setCookie ( "ttrss_ci_width" , args . w , getInitParam ( "cookie_lifetime" ) ) ;
setCookie ( "ttrss_fh_width" , args . w , getInitParam ( "cookie_lifetime" ) ) ;
setCookie ( "ttrss_ci_height" , args . h , getInitParam ( "cookie_lifetime" ) ) ;
}
}
} ) ;
} ) ;
delCookie ( "ttrss_test" ) ;
var tmph = dojo . connect ( dijit . byId ( 'content-insert' ) , 'resize' ,
function ( args ) {
if ( args && args . w >= 0 && args . h >= 0 ) {
setCookie ( "ttrss_ci_width" , args . w , getInitParam ( "cookie_lifetime" ) ) ;
setCookie ( "ttrss_ci_height" , args . h , getInitParam ( "cookie_lifetime" ) ) ;
}
} ) ;
var toolbar = document . forms [ "main_toolbar_form" ] ;
delCookie ( "ttrss_test" ) ;
dijit . getEnclosingWidget ( toolbar . view _mode ) . attr ( 'value' ,
var toolbar = document . forms [ "main_toolbar_form" ] ;
getInitParam ( "default_view_mode" ) ) ;
dijit . getEnclosingWidget ( toolbar . order_by ) . attr ( 'value' ,
dijit . getEnclosingWidget ( toolbar . view_mode ) . attr ( 'value' ,
getInitParam ( "default_view_ or der_by ") ) ;
getInitParam ( "default_view_ m ode") ) ;
feeds _sort _by _unread = getInitParam ( "feeds_sort_by_unread" ) == 1 ;
dijit . getEnclosingWidget ( toolbar . order _by ) . attr ( 'value' ,
getInitParam ( "default_view_order_by" ) ) ;
var hash _feed _id = hash _get ( 'f' ) ;
feeds _sort _by _unread = getInitParam ( "feeds_sort_by_unread" ) == 1 ;
var hash _feed _is _cat = hash _get ( 'c' ) == "1" ;
if ( hash _feed _id != undefined ) {
var hash _feed _id = hash _get ( 'f' ) ;
setActiveFeedId ( hash _feed _id , hash _feed _is _cat ) ;
var hash _feed _is _cat = hash _get ( 'c' ) == "1" ;
}
loading _set _progress ( 50 ) ;
if ( hash _feed _id != undefined ) {
setActiveFeedId ( hash _feed _id , hash _feed _is _cat ) ;
}
// can't use cache_clear() here because viewfeed might not have initialized yet
loading _set _progress ( 50 ) ;
if ( 'sessionStorage' in window && window [ 'sessionStorage' ] !== null )
sessionStorage . clear ( ) ;
var hotkeys = getInitParam ( "hotkeys" ) ;
// can't use cache_clear() here because viewfeed might not have initialized yet
var tmp = [ ] ;
if ( 'sessionStorage' in window && window [ 'sessionStorage' ] !== null )
sessionStorage . clear ( ) ;
for ( sequence in hotkeys [ 1 ] ) {
var hotkeys = getInitParam ( "hotkeys" ) ;
filtered = sequence . replace ( /\|.*$/ , "" ) ;
var tmp = [ ] ;
tmp [ filtered ] = hotkeys [ 1 ] [ sequence ] ;
}
hotkeys [ 1 ] = tmp ;
for ( sequence in hotkeys [ 1 ] ) {
setInitParam ( "hotkeys" , hotkeys ) ;
filtered = sequence . replace ( /\|.*$/ , "" ) ;
tmp [ filtered ] = hotkeys [ 1 ] [ sequence ] ;
}
_widescreen _mode = getInitParam ( "widescreen" ) ;
hotkeys [ 1 ] = tmp ;
switchPanelMode ( _widescreen _mode ) ;
setInitParam ( "hotkeys" , hotkeys ) ;
console . log ( "second stage ok" ) ;
_widescreen _mode = getInitParam ( "widescreen" ) ;
switchPanelMode ( _widescreen _mode ) ;
if ( getInitParam ( "simple_update" ) ) {
console . log ( "second stage ok" ) ;
console . log ( "scheduling simple feed updater..." ) ;
window . setTimeout ( update _random _feed , 30 * 1000 ) ;
}
} catch ( e ) {
if ( getInitParam ( "simple_update" ) ) {
exception _error ( "init_second_stage" , e ) ;
console . log ( "scheduling simple feed updater..." ) ;
window . setTimeout ( update _random _feed , 30 * 1000 ) ;
}
}
}
}
function quickMenuGo ( opid ) {
function quickMenuGo ( opid ) {
try {
switch ( opid ) {
switch ( opid ) {
case "qmcPrefs" :
case "qmcPrefs" :
gotoPreferences ( ) ;
gotoPreferences ( ) ;
break ;
break ;
case "qmcLogout" :
case "qmcLogout" :
gotoLogout ( ) ;
gotoLogout ( ) ;
break ;
break ;
case "qmcTagCloud" :
case "qmcTagCloud" :
displayDlg ( _ _ ( "Tag cloud" ) , "printTagCloud" ) ;
displayDlg ( _ _ ( "Tag cloud" ) , "printTagCloud" ) ;
break ;
break ;
case "qmcSearch" :
case "qmcSearch" :
search ( ) ;
search ( ) ;
break ;
break ;
case "qmcAddFeed" :
case "qmcAddFeed" :
quickAddFeed ( ) ;
quickAddFeed ( ) ;
break ;
break ;
case "qmcDigest" :
case "qmcDigest" :
window . location . href = "backend.php?op=digest" ;
window . location . href = "backend.php?op=digest" ;
break ;
break ;
case "qmcEditFeed" :
case "qmcEditFeed" :
if ( activeFeedIsCat ( ) )
if ( activeFeedIsCat ( ) )
alert ( _ _ ( "You can't edit this kind of feed." ) ) ;
alert ( _ _ ( "You can't edit this kind of feed." ) ) ;
else
else
editFeed ( getActiveFeedId ( ) ) ;
editFeed ( getActiveFeedId ( ) ) ;
break ;
break ;
case "qmcRemoveFeed" :
case "qmcRemoveFeed" :
var actid = getActiveFeedId ( ) ;
var actid = getActiveFeedId ( ) ;
if ( activeFeedIsCat ( ) ) {
if ( activeFeedIsCat ( ) ) {
alert ( _ _ ( "You can't unsubscribe from the category." ) ) ;
alert ( _ _ ( "You can't unsubscribe from the category." ) ) ;
return ;
return ;
}
}
if ( ! actid ) {
if ( ! actid ) {
alert ( _ _ ( "Please select some feed first." ) ) ;
alert ( _ _ ( "Please select some feed first." ) ) ;
return ;
return ;
}
}
var fn = getFeedName ( actid ) ;
var fn = getFeedName ( actid ) ;
var pr = _ _ ( "Unsubscribe from %s?" ) . replace ( "%s" , fn ) ;
var pr = _ _ ( "Unsubscribe from %s?" ) . replace ( "%s" , fn ) ;
if ( confirm ( pr ) ) {
if ( confirm ( pr ) ) {
unsubscribeFeed ( actid ) ;
unsubscribeFeed ( actid ) ;
}
}
break ;
break ;
case "qmcCatchupAll" :
case "qmcCatchupAll" :
catchupAllFeeds ( ) ;
catchupAllFeeds ( ) ;
break ;
break ;
case "qmcShowOnlyUnread" :
case "qmcShowOnlyUnread" :
toggleDispRead ( ) ;
toggleDispRead ( ) ;
break ;
break ;
case "qmcAddFilter" :
case "qmcAddFilter" :
quickAddFilter ( ) ;
quickAddFilter ( ) ;
break ;
break ;
case "qmcAddLabel" :
case "qmcAddLabel" :
addLabel ( ) ;
addLabel ( ) ;
break ;
break ;
case "qmcRescoreFeed" :
case "qmcRescoreFeed" :
rescoreCurrentFeed ( ) ;
rescoreCurrentFeed ( ) ;
break ;
break ;
case "qmcToggleWidescreen" :
case "qmcToggleWidescreen" :
if ( ! isCdmMode ( ) ) {
if ( ! isCdmMode ( ) ) {
_widescreen _mode = ! _widescreen _mode ;
_widescreen _mode = ! _widescreen _mode ;
// reset stored sizes because geometry changed
// reset stored sizes because geometry changed
setCookie ( "ttrss_ci_width" , 0 ) ;
setCookie ( "ttrss_ci_width" , 0 ) ;
setCookie ( "ttrss_ci_height" , 0 ) ;
setCookie ( "ttrss_ci_height" , 0 ) ;
switchPanelMode ( _widescreen _mode ) ;
switchPanelMode ( _widescreen _mode ) ;
} else {
} else {
alert ( _ _ ( "Widescreen is not available in combined mode." ) ) ;
alert ( _ _ ( "Widescreen is not available in combined mode." ) ) ;
}
break ;
case "qmcHKhelp" :
helpDialog ( "main" ) ;
break ;
default :
console . log ( "quickMenuGo: unknown action: " + opid ) ;
}
}
break ;
} catch ( e ) {
case "qmcHKhelp" :
exception _error ( "quickMenuGo" , e ) ;
helpDialog ( "main" ) ;
break ;
default :
console . log ( "quickMenuGo: unknown action: " + opid ) ;
}
}
}
}
function toggleDispRead ( ) {
function toggleDispRead ( ) {
try {
var hide = ! ( getInitParam ( "hide_read_feeds" ) == "1" ) ;
var hide = ! ( getInitParam ( "hide_read_feeds" ) == "1" ) ;
hideOrShowFeeds ( hide ) ;
hideOrShowFeeds ( hide ) ;
var query = "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
var query = "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
param _escape ( hide ) ;
param _escape ( hide ) ;
setInitParam ( "hide_read_feeds" , hide ) ;
setInitParam ( "hide_read_feeds" , hide ) ;
new Ajax . Request ( "backend.php" , {
new Ajax . Request ( "backend.php" , {
parameters : query ,
parameters : query ,
onComplete : function ( transport ) {
onComplete : function ( transport ) {
} } ) ;
} } ) ;
} catch ( e ) {
exception _error ( "toggleDispRead" , e ) ;
}
}
}
function parse _runtime _info ( data ) {
function parse _runtime _info ( data ) {
@ -825,18 +798,13 @@ function parse_runtime_info(data) {
}
}
function collapse _feedlist ( ) {
function collapse _feedlist ( ) {
try {
Element . toggle ( "feeds-holder" ) ;
Element . toggle ( "feeds-holder" ) ;
var splitter = $ ( "feeds-holder_splitter" ) ;
var splitter = $ ( "feeds-holder_splitter" ) ;
Element . visible ( "feeds-holder" ) ? splitter . show ( ) : splitter . hide ( ) ;
Element . visible ( "feeds-holder" ) ? splitter . show ( ) : splitter . hide ( ) ;
dijit . byId ( "main" ) . resize ( ) ;
dijit . byId ( "main" ) . resize ( ) ;
} catch ( e ) {
exception _error ( "collapse_feedlist" , e ) ;
}
}
}
function viewModeChanged ( ) {
function viewModeChanged ( ) {
@ -875,88 +843,83 @@ function rescoreCurrentFeed() {
}
}
function hotkey _handler ( e ) {
function hotkey _handler ( e ) {
try {
if ( e . target . nodeName == "INPUT" || e . target . nodeName == "TEXTAREA" ) return ;
if ( e . target . nodeName == "INPUT" || e . target . nodeName == "TEXTAREA" ) return ;
var keycode = false ;
var keycode = false ;
var shift _key = false ;
var shift _key = false ;
var ctrl _key = false ;
var ctrl _key = false ;
var alt _key = false ;
var alt _key = false ;
var meta _key = false ;
var meta _key = false ;
var cmdline = $ ( 'cmdline' ) ;
var cmdline = $ ( 'cmdline' ) ;
shift _key = e . shiftKey ;
shift _key = e . shiftKey ;
ctrl _key = e . ctrlKey ;
ctrl _key = e . ctrlKey ;
alt _key = e . altKey ;
alt _key = e . altKey ;
meta _key = e . metaKey ;
meta _key = e . metaKey ;
if ( window . event ) {
if ( window . event ) {
keycode = window . event . keyCode ;
keycode = window . event . keyCode ;
} else if ( e ) {
} else if ( e ) {
keycode = e . which ;
keycode = e . which ;
}
}
var keychar = String . fromCharCode ( keycode ) ;
var keychar = String . fromCharCode ( keycode ) ;
if ( keycode == 27 ) { // escape
if ( keycode == 27 ) { // escape
hotkey _prefix = false ;
hotkey _prefix = false ;
}
}
if ( keycode == 16 ) return ; // ignore lone shift
if ( keycode == 16 ) return ; // ignore lone shift
if ( keycode == 17 ) return ; // ignore lone ctrl
if ( keycode == 17 ) return ; // ignore lone ctrl
keychar = keychar . toLowerCase ( ) ;
keychar = keychar . toLowerCase ( ) ;
var hotkeys = getInitParam ( "hotkeys" ) ;
var hotkeys = getInitParam ( "hotkeys" ) ;
if ( ! hotkey _prefix && hotkeys [ 0 ] . indexOf ( keychar ) != - 1 ) {
if ( ! hotkey _prefix && hotkeys [ 0 ] . indexOf ( keychar ) != - 1 ) {
var date = new Date ( ) ;
var date = new Date ( ) ;
var ts = Math . round ( date . getTime ( ) / 1000 ) ;
var ts = Math . round ( date . getTime ( ) / 1000 ) ;
hotkey _prefix = keychar ;
hotkey _prefix = keychar ;
hotkey _prefix _pressed = ts ;
hotkey _prefix _pressed = ts ;
cmdline . innerHTML = keychar ;
cmdline . innerHTML = keychar ;
Element . show ( cmdline ) ;
Element . show ( cmdline ) ;
return true ;
return true ;
}
}
Element . hide ( cmdline ) ;
Element . hide ( cmdline ) ;
var hotkey = keychar . search ( /[a-zA-Z0-9]/ ) != - 1 ? keychar : "(" + keycode + ")" ;
var hotkey = keychar . search ( /[a-zA-Z0-9]/ ) != - 1 ? keychar : "(" + keycode + ")" ;
// ensure ^*char notation
// ensure ^*char notation
if ( shift _key ) hotkey = "*" + hotkey ;
if ( shift _key ) hotkey = "*" + hotkey ;
if ( ctrl _key ) hotkey = "^" + hotkey ;
if ( ctrl _key ) hotkey = "^" + hotkey ;
if ( alt _key ) hotkey = "+" + hotkey ;
if ( alt _key ) hotkey = "+" + hotkey ;
if ( meta _key ) hotkey = "%" + hotkey ;
if ( meta _key ) hotkey = "%" + hotkey ;
hotkey = hotkey _prefix ? hotkey _prefix + " " + hotkey : hotkey ;
hotkey = hotkey _prefix ? hotkey _prefix + " " + hotkey : hotkey ;
hotkey _prefix = false ;
hotkey _prefix = false ;
var hotkey _action = false ;
var hotkey _action = false ;
var hotkeys = getInitParam ( "hotkeys" ) ;
var hotkeys = getInitParam ( "hotkeys" ) ;
for ( sequence in hotkeys [ 1 ] ) {
for ( sequence in hotkeys [ 1 ] ) {
if ( sequence == hotkey ) {
if ( sequence == hotkey ) {
hotkey _action = hotkeys [ 1 ] [ sequence ] ;
hotkey _action = hotkeys [ 1 ] [ sequence ] ;
break ;
break ;
}
}
}
}
var action = hotkey _actions [ hotkey _action ] ;
var action = hotkey _actions [ hotkey _action ] ;
if ( action != null ) {
action ( ) ;
return false ;
}
} catch ( e ) {
if ( action != null ) {
exception _error ( "hotkey_handler" , e ) ;
action ( ) ;
return false ;
}
}
}
}
@ -965,33 +928,21 @@ function inPreferences() {
}
}
function reverseHeadlineOrder ( ) {
function reverseHeadlineOrder ( ) {
try {
/ * v a r q u e r y _ s t r = " ? o p = r p c & m e t h o d = t o g g l e p r e f & k e y = R E V E R S E _ H E A D L I N E S " ;
new Ajax . Request ( "backend.php" , {
parameters : query _str ,
onComplete : function ( transport ) {
viewCurrentFeed ( ) ;
} } ) ; * /
var toolbar = document . forms [ "main_toolbar_form" ] ;
var toolbar = document . forms [ "main_toolbar_form" ] ;
var order _by = dijit . getEnclosingWidget ( toolbar . order _by ) ;
var order _by = dijit . getEnclosingWidget ( toolbar . order _by ) ;
var value = order _by . attr ( 'value' ) ;
var value = order _by . attr ( 'value' ) ;
if ( value == "date_reverse" )
if ( value == "date_reverse" )
value = "default" ;
value = "default" ;
else
else
value = "date_reverse" ;
value = "date_reverse" ;
order _by . attr ( 'value' , value ) ;
order _by . attr ( 'value' , value ) ;
viewCurrentFeed ( ) ;
viewCurrentFeed ( ) ;
} catch ( e ) {
exception _error ( "reverseHeadlineOrder" , e ) ;
}
}
}
function handle _rpc _json ( transport , scheduled _call ) {
function handle _rpc _json ( transport , scheduled _call ) {
@ -1065,99 +1016,79 @@ function handle_rpc_json(transport, scheduled_call) {
else
else
notify _error ( "Communication problem with server." ) ;
notify _error ( "Communication problem with server." ) ;
console . log ( e ) ;
console . error ( e ) ;
//exception_error("handle_rpc_json", e, transport);
}
}
return true ;
return true ;
}
}
function switchPanelMode ( wide ) {
function switchPanelMode ( wide ) {
try {
if ( isCdmMode ( ) ) return ;
if ( isCdmMode ( ) ) return ;
article _id = getActiveArticleId ( ) ;
if ( wide ) {
article _id = getActiveArticleId ( ) ;
dijit . byId ( "headlines-wrap-inner" ) . attr ( "design" , 'sidebar' ) ;
dijit . byId ( "content-insert" ) . attr ( "region" , "trailing" ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : '50%' ,
if ( wide ) {
height : 'auto' ,
dijit . byId ( "headlines-wrap-inner" ) . attr ( "design" , 'sidebar' ) ;
borderTopWidth : '0px' } ) ;
dijit . byId ( "content-insert" ) . attr ( "region" , "trailing" ) ;
if ( parseInt ( getCookie ( "ttrss_ci_width" ) ) > 0 ) {
dijit . byId ( "content-insert" ) . domNode . setStyle (
{ width : getCookie ( "ttrss_ci_width" ) + "px" } ) ;
}
$ ( "headlines-frame" ) . setStyle ( { borderBottomWidth : '0px' } ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : '50%' ,
$ ( "headlines-frame" ) . addClassName ( "wide" ) ;
height : 'auto' ,
borderTopWidth : '0px' } ) ;
} else {
if ( parseInt ( getCookie ( "ttrss_ci_width" ) ) > 0 ) {
dijit . byId ( "content-insert" ) . domNode . setStyle (
{ width : getCookie ( "ttrss_ci_width" ) + "px" } ) ;
}
dijit . byId ( "content-insert" ) . attr ( "region" , "bottom" ) ;
$ ( "headlines-frame" ) . setStyle ( { borderBottomWidth : '0px' } ) ;
$ ( "headlines-frame" ) . addClassName ( "wide" ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : 'auto' ,
} else {
height : '50%' ,
borderTopWidth : '0px' } ) ;
if ( parseInt ( getCookie ( "ttrss_ci_height" ) ) > 0 ) {
dijit . byId ( "content-insert" ) . attr ( "region" , "bottom" ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle (
{ height : getCookie ( "ttrss_ci_height" ) + "px" } ) ;
}
$ ( "headlines-frame" ) . setStyle ( { borderBottomWidth : '1px' } ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : 'auto' ,
$ ( "headlines-frame" ) . removeClassName ( "wide" ) ;
height : '50%' ,
borderTopWidth : '0px' } ) ;
if ( parseInt ( getCookie ( "ttrss_ci_height" ) ) > 0 ) {
dijit . byId ( "content-insert" ) . domNode . setStyle (
{ height : getCookie ( "ttrss_ci_height" ) + "px" } ) ;
}
}
closeArticlePanel ( ) ;
$ ( "headlines-frame" ) . setStyle ( { borderBottomWidth : '1px' } ) ;
$ ( "headlines-frame" ) . removeClassName ( "wide" ) ;
if ( article _id ) view ( article _id ) ;
}
new Ajax . Request ( "backend.php" , {
closeArticlePanel ( ) ;
parameters : "op=rpc&method=setpanelmode&wide=" + ( wide ? 1 : 0 ) ,
onComplete : function ( transport ) {
console . log ( transport . responseText ) ;
} } ) ;
if ( article _id ) view ( article _id ) ;
} catch ( e ) {
new Ajax . Request ( "backend.php" , {
exception _error ( "switchPanelMode" , e ) ;
parameters : "op=rpc&method=setpanelmode&wide=" + ( wide ? 1 : 0 ) ,
}
onComplete : function ( transport ) {
console . log ( transport . responseText ) ;
} } ) ;
}
}
function update _random _feed ( ) {
function update _random _feed ( ) {
try {
console . log ( "in update_random_feed" ) ;
console . log ( "in update_random_feed" ) ;
new Ajax . Request ( "backend.php" , {
parameters : "op=rpc&method=updateRandomFeed" ,
onComplete : function ( transport ) {
handle _rpc _json ( transport , true ) ;
window . setTimeout ( update _random _feed , 30 * 1000 ) ;
} } ) ;
} catch ( e ) {
new Ajax . Request ( "backend.php" , {
exception _error ( "update_random_feed" , e ) ;
parameters : "op=rpc&method=updateRandomFeed" ,
}
onComplete : function ( transport ) {
handle _rpc _json ( transport , true ) ;
window . setTimeout ( update _random _feed , 30 * 1000 ) ;
} } ) ;
}
}
function hash _get ( key ) {
function hash _get ( key ) {
try {
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
return kv [ key ] ;
return kv [ key ] ;
} catch ( e ) {
exception _error ( "hash_get" , e ) ;
}
}
}
function hash _set ( key , value ) {
function hash _set ( key , value ) {
try {
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
kv [ key ] = value ;
kv [ key ] = value ;
window . location . hash = $H ( kv ) . toQueryString ( ) ;
window . location . hash = $H ( kv ) . toQueryString ( ) ;
} catch ( e ) {
exception _error ( "hash_set" , e ) ;
}
}
}