@ -21,108 +21,92 @@ function activeFeedIsCat() {
}
function getActiveFeedId ( ) {
try {
return _active _feed _id ;
} catch ( e ) {
exception _error ( "getActiveFeedId" , e ) ;
}
return _active _feed _id ;
}
function setActiveFeedId ( id , is _cat ) {
try {
hash _set ( 'f' , id ) ;
hash _set ( 'c' , is _cat ? 1 : 0 ) ;
hash _set ( 'f' , id ) ;
hash _set ( 'c' , is _cat ? 1 : 0 ) ;
_active _feed _id = id ;
_active _feed _is _cat = is _cat ;
_active _feed _id = id ;
_active _feed _is _cat = is _cat ;
$ ( "headlines-frame" ) . setAttribute ( "feed-id" , id ) ;
$ ( "headlines-frame" ) . setAttribute ( "is-cat" , is _cat ? 1 : 0 ) ;
$ ( "headlines-frame" ) . setAttribute ( "feed-id" , id ) ;
$ ( "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 ) ;
} catch ( e ) {
exception _error ( "setActiveFeedId" , e ) ;
}
PluginHost . run ( PluginHost . HOOK _FEED _SET _ACTIVE , _active _article _id ) ;
}
function updateFeedList ( ) {
try {
// $("feeds-holder").innerHTML = "<div id=\"feedlistLoading\">" +
// __("Loading, please wait...") + "</div>";
Element . show ( "feedlistLoading" ) ;
Element . show ( "feedlistLoading" ) ;
resetCounterCache ( ) ;
resetCounterCache ( ) ;
if ( dijit . byId ( "feedTree" ) ) {
dijit . byId ( "feedTree" ) . destroyRecursive ( ) ;
}
if ( dijit . byId ( "feedTree" ) ) {
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" } ) ;
var treeModel = new fox . FeedStoreModel ( {
store : store ,
query : {
"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 ;
var treeModel = new fox . FeedStoreModel ( {
store : store ,
query : {
"type" : getInitParam ( 'enable_feed_cats' ) == 1 ? "category" : "feed"
} ,
openOnClick : false ,
showRoot : false ,
persist : true ,
id : "feedTree" ,
} , "feedTree" ) ;
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 ,
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 ' } ) ;
menu . addChild ( new dijit . MenuItem ( {
menu . addChild ( new dijit . MenuItem ( {
label : "Simple menu item"
} ) ) ;
} ) ) ;
// menu.bindDomNode(tree.domNode); */
var tmph = dojo . connect ( dijit . byId ( 'feedMenu' ) , '_openMyself' , function ( event ) {
console . log ( dijit . getEnclosingWidget ( event . target ) ) ;
dojo . disconnect ( tmph ) ;
} ) ;
var tmph = dojo . connect ( dijit . byId ( 'feedMenu' ) , '_openMyself' , function ( event ) {
console . log ( dijit . getEnclosingWidget ( event . target ) ) ;
dojo . disconnect ( tmph ) ;
} ) ;
$ ( "feeds-holder" ) . appendChild ( tree . domNode ) ;
$ ( "feeds-holder" ) . appendChild ( tree . domNode ) ;
var tmph = dojo . connect ( tree , 'onLoad' , function ( ) {
dojo . disconnect ( tmph ) ;
Element . hide ( "feedlistLoading" ) ;
var tmph = dojo . connect ( tree , 'onLoad' , function ( ) {
dojo . disconnect ( tmph ) ;
Element . hide ( "feedlistLoading" ) ;
try {
feedlist _init ( ) ;
// var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
// menu.bindDomNode(node);
loading _set _progress ( 25 ) ;
} ) ;
tree . startup ( ) ;
} catch ( e ) {
exception _error ( e ) ;
}
} ) ;
} catch ( e ) {
exception _error ( "updateFeedList" , e ) ;
}
tree . startup ( ) ;
}
function catchupAllFeeds ( ) {
@ -218,46 +202,49 @@ function genericSanityCheck() {
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 ( ) ;
if ( ! genericSanityCheck ( ) )
@ -274,24 +261,25 @@ function init() {
init _hotkey _actions ( ) ;
new Ajax . Request ( "backend.php" , {
parameters : { op : "rpc" , method : "sanityCheck" , hasAudio : hasAudio ,
new Ajax . Request ( "backend.php" , {
parameters : {
op : "rpc" , method : "sanityCheck" , hasAudio : hasAudio ,
hasMp3 : hasMp3 ,
clientTzOffset : clientTzOffset ,
hasSandbox : hasSandbox } ,
onComplete : function ( transport ) {
hasSandbox : hasSandbox
} ,
onComplete : function ( transport ) {
backend _sanity _check _callback ( transport ) ;
} } ) ;
} ) ;
}
} ) ;
} catch ( e ) {
exception _error ( e ) ;
}
} ) ;
} ) ;
} catch ( e ) {
exception _error ( "init" , e ) ;
}
} ) ;
}
function init _hotkey _actions ( ) {
@ -587,192 +575,177 @@ function init_hotkey_actions() {
}
function init _second _stage ( ) {
updateFeedList ( ) ;
closeArticlePanel ( ) ;
try {
updateFeedList ( ) ;
closeArticlePanel ( ) ;
if ( parseInt ( getCookie ( "ttrss_fh_width" ) ) > 0 ) {
dijit . byId ( "feeds-holder" ) . domNode . setStyle (
{ width : getCookie ( "ttrss_fh_width" ) + "px" } ) ;
}
dijit . byId ( "main" ) . resize ( ) ;
if ( parseInt ( getCookie ( "ttrss_fh_width" ) ) > 0 ) {
dijit . byId ( "feeds-holder" ) . domNode . setStyle (
{ width : getCookie ( "ttrss_fh_width" ) + "px" } ) ;
}
var tmph = dojo . connect ( dijit . byId ( 'feeds-holder' ) , 'resize' ,
function ( args ) {
if ( args && args . w >= 0 ) {
setCookie ( "ttrss_fh_width" , args . w , getInitParam ( "cookie_lifetime" ) ) ;
}
} ) ;
dijit . byId ( "main" ) . resize ( ) ;
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 tmph = dojo . connect ( dijit . byId ( 'feeds-holder' ) , 'resize' ,
function ( args ) {
if ( args && args . w >= 0 ) {
setCookie ( "ttrss_fh_width" , args . w , 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' ,
getInitParam ( "default_view_mode" ) ) ;
var toolbar = document . forms [ "main_toolbar_form" ] ;
dijit . getEnclosingWidget ( toolbar . order_by ) . attr ( 'value' ,
getInitParam ( "default_view_ or der_by ") ) ;
dijit . getEnclosingWidget ( toolbar . view_mode ) . attr ( 'value' ,
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' ) ;
var hash _feed _is _cat = hash _get ( 'c' ) == "1" ;
feeds _sort _by _unread = getInitParam ( "feeds_sort_by_unread" ) == 1 ;
if ( hash _feed _id != undefined ) {
setActiveFeedId ( hash _feed _id , hash _feed _is _cat ) ;
}
var hash _feed _id = hash _get ( 'f' ) ;
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
if ( 'sessionStorage' in window && window [ 'sessionStorage' ] !== null )
sessionStorage . clear ( ) ;
loading _set _progress ( 50 ) ;
var hotkeys = getInitParam ( "hotkeys" ) ;
var tmp = [ ] ;
// can't use cache_clear() here because viewfeed might not have initialized yet
if ( 'sessionStorage' in window && window [ 'sessionStorage' ] !== null )
sessionStorage . clear ( ) ;
for ( sequence in hotkeys [ 1 ] ) {
filtered = sequence . replace ( /\|.*$/ , "" ) ;
tmp [ filtered ] = hotkeys [ 1 ] [ sequence ] ;
}
var hotkeys = getInitParam ( "hotkeys" ) ;
var tmp = [ ] ;
hotkeys [ 1 ] = tmp ;
setInitParam ( "hotkeys" , hotkeys ) ;
for ( sequence in hotkeys [ 1 ] ) {
filtered = sequence . replace ( /\|.*$/ , "" ) ;
tmp [ filtered ] = hotkeys [ 1 ] [ sequence ] ;
}
_widescreen _mode = getInitParam ( "widescreen" ) ;
switchPanelMode ( _widescreen _mode ) ;
hotkeys [ 1 ] = tmp ;
setInitParam ( "hotkeys" , hotkeys ) ;
console . log ( "second stage ok" ) ;
_widescreen _mode = getInitParam ( "widescreen" ) ;
switchPanelMode ( _widescreen _mode ) ;
if ( getInitParam ( "simple_update" ) ) {
console . log ( "scheduling simple feed updater..." ) ;
window . setTimeout ( update _random _feed , 30 * 1000 ) ;
}
console . log ( "second stage ok" ) ;
} catch ( e ) {
exception _error ( "init_second_stage" , e ) ;
if ( getInitParam ( "simple_update" ) ) {
console . log ( "scheduling simple feed updater..." ) ;
window . setTimeout ( update _random _feed , 30 * 1000 ) ;
}
}
function quickMenuGo ( opid ) {
try {
switch ( opid ) {
case "qmcPrefs" :
gotoPreferences ( ) ;
break ;
case "qmcLogout" :
gotoLogout ( ) ;
break ;
case "qmcTagCloud" :
displayDlg ( _ _ ( "Tag cloud" ) , "printTagCloud" ) ;
break ;
case "qmcSearch" :
search ( ) ;
break ;
case "qmcAddFeed" :
quickAddFeed ( ) ;
break ;
case "qmcDigest" :
window . location . href = "backend.php?op=digest" ;
break ;
case "qmcEditFeed" :
if ( activeFeedIsCat ( ) )
alert ( _ _ ( "You can't edit this kind of feed." ) ) ;
else
editFeed ( getActiveFeedId ( ) ) ;
break ;
case "qmcRemoveFeed" :
var actid = getActiveFeedId ( ) ;
switch ( opid ) {
case "qmcPrefs" :
gotoPreferences ( ) ;
break ;
case "qmcLogout" :
gotoLogout ( ) ;
break ;
case "qmcTagCloud" :
displayDlg ( _ _ ( "Tag cloud" ) , "printTagCloud" ) ;
break ;
case "qmcSearch" :
search ( ) ;
break ;
case "qmcAddFeed" :
quickAddFeed ( ) ;
break ;
case "qmcDigest" :
window . location . href = "backend.php?op=digest" ;
break ;
case "qmcEditFeed" :
if ( activeFeedIsCat ( ) )
alert ( _ _ ( "You can't edit this kind of feed." ) ) ;
else
editFeed ( getActiveFeedId ( ) ) ;
break ;
case "qmcRemoveFeed" :
var actid = getActiveFeedId ( ) ;
if ( activeFeedIsCat ( ) ) {
alert ( _ _ ( "You can't unsubscribe from the category." ) ) ;
return ;
}
if ( activeFeedIsCat ( ) ) {
alert ( _ _ ( "You can't unsubscribe from the category." ) ) ;
return ;
}
if ( ! actid ) {
alert ( _ _ ( "Please select some feed first." ) ) ;
return ;
}
if ( ! actid ) {
alert ( _ _ ( "Please select some feed first." ) ) ;
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 ) ) {
unsubscribeFeed ( actid ) ;
}
break ;
case "qmcCatchupAll" :
catchupAllFeeds ( ) ;
break ;
case "qmcShowOnlyUnread" :
toggleDispRead ( ) ;
break ;
case "qmcAddFilter" :
quickAddFilter ( ) ;
break ;
case "qmcAddLabel" :
addLabel ( ) ;
break ;
case "qmcRescoreFeed" :
rescoreCurrentFeed ( ) ;
break ;
case "qmcToggleWidescreen" :
if ( ! isCdmMode ( ) ) {
_widescreen _mode = ! _widescreen _mode ;
if ( confirm ( pr ) ) {
unsubscribeFeed ( actid ) ;
}
break ;
case "qmcCatchupAll" :
catchupAllFeeds ( ) ;
break ;
case "qmcShowOnlyUnread" :
toggleDispRead ( ) ;
break ;
case "qmcAddFilter" :
quickAddFilter ( ) ;
break ;
case "qmcAddLabel" :
addLabel ( ) ;
break ;
case "qmcRescoreFeed" :
rescoreCurrentFeed ( ) ;
break ;
case "qmcToggleWidescreen" :
if ( ! isCdmMode ( ) ) {
_widescreen _mode = ! _widescreen _mode ;
// reset stored sizes because geometry changed
setCookie ( "ttrss_ci_width" , 0 ) ;
setCookie ( "ttrss_ci_height" , 0 ) ;
// reset stored sizes because geometry changed
setCookie ( "ttrss_ci_width" , 0 ) ;
setCookie ( "ttrss_ci_height" , 0 ) ;
switchPanelMode ( _widescreen _mode ) ;
} else {
alert ( _ _ ( "Widescreen is not available in combined mode." ) ) ;
}
break ;
case "qmcHKhelp" :
helpDialog ( "main" ) ;
break ;
default :
console . log ( "quickMenuGo: unknown action: " + opid ) ;
switchPanelMode ( _widescreen _mode ) ;
} else {
alert ( _ _ ( "Widescreen is not available in combined mode." ) ) ;
}
} catch ( e ) {
exception _error ( "quickMenuGo" , e ) ;
break ;
case "qmcHKhelp" :
helpDialog ( "main" ) ;
break ;
default :
console . log ( "quickMenuGo: unknown action: " + opid ) ;
}
}
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=" +
param _escape ( hide ) ;
var query = "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
param _escape ( hide ) ;
setInitParam ( "hide_read_feeds" , hide ) ;
setInitParam ( "hide_read_feeds" , hide ) ;
new Ajax . Request ( "backend.php" , {
parameters : query ,
onComplete : function ( transport ) {
} } ) ;
new Ajax . Request ( "backend.php" , {
parameters : query ,
onComplete : function ( transport ) {
} } ) ;
} catch ( e ) {
exception _error ( "toggleDispRead" , e ) ;
}
}
function parse _runtime _info ( data ) {
@ -825,18 +798,13 @@ function parse_runtime_info(data) {
}
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 ( ) ;
} catch ( e ) {
exception _error ( "collapse_feedlist" , e ) ;
}
dijit . byId ( "main" ) . resize ( ) ;
}
function viewModeChanged ( ) {
@ -875,88 +843,83 @@ function rescoreCurrentFeed() {
}
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 shift _key = false ;
var ctrl _key = false ;
var alt _key = false ;
var meta _key = false ;
var keycode = false ;
var shift _key = false ;
var ctrl _key = false ;
var alt _key = false ;
var meta _key = false ;
var cmdline = $ ( 'cmdline' ) ;
var cmdline = $ ( 'cmdline' ) ;
shift _key = e . shiftKey ;
ctrl _key = e . ctrlKey ;
alt _key = e . altKey ;
meta _key = e . metaKey ;
shift _key = e . shiftKey ;
ctrl _key = e . ctrlKey ;
alt _key = e . altKey ;
meta _key = e . metaKey ;
if ( window . event ) {
keycode = window . event . keyCode ;
} else if ( e ) {
keycode = e . which ;
}
if ( window . event ) {
keycode = window . event . keyCode ;
} else if ( e ) {
keycode = e . which ;
}
var keychar = String . fromCharCode ( keycode ) ;
var keychar = String . fromCharCode ( keycode ) ;
if ( keycode == 27 ) { // escape
hotkey _prefix = false ;
}
if ( keycode == 27 ) { // escape
hotkey _prefix = false ;
}
if ( keycode == 16 ) return ; // ignore lone shift
if ( keycode == 17 ) return ; // ignore lone ctrl
if ( keycode == 16 ) return ; // ignore lone shift
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 ts = Math . round ( date . getTime ( ) / 1000 ) ;
var date = new Date ( ) ;
var ts = Math . round ( date . getTime ( ) / 1000 ) ;
hotkey _prefix = keychar ;
hotkey _prefix _pressed = ts ;
hotkey _prefix = keychar ;
hotkey _prefix _pressed = ts ;
cmdline . innerHTML = keychar ;
Element . show ( cmdline ) ;
cmdline . innerHTML = keychar ;
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
if ( shift _key ) hotkey = "*" + hotkey ;
if ( ctrl _key ) hotkey = "^" + hotkey ;
if ( alt _key ) hotkey = "+" + hotkey ;
if ( meta _key ) hotkey = "%" + hotkey ;
// ensure ^*char notation
if ( shift _key ) hotkey = "*" + hotkey ;
if ( ctrl _key ) hotkey = "^" + hotkey ;
if ( alt _key ) hotkey = "+" + hotkey ;
if ( meta _key ) hotkey = "%" + hotkey ;
hotkey = hotkey _prefix ? hotkey _prefix + " " + hotkey : hotkey ;
hotkey _prefix = false ;
hotkey = hotkey _prefix ? hotkey _prefix + " " + hotkey : hotkey ;
hotkey _prefix = false ;
var hotkey _action = false ;
var hotkeys = getInitParam ( "hotkeys" ) ;
var hotkey _action = false ;
var hotkeys = getInitParam ( "hotkeys" ) ;
for ( sequence in hotkeys [ 1 ] ) {
if ( sequence == hotkey ) {
hotkey _action = hotkeys [ 1 ] [ sequence ] ;
break ;
}
for ( sequence in hotkeys [ 1 ] ) {
if ( sequence == hotkey ) {
hotkey _action = hotkeys [ 1 ] [ sequence ] ;
break ;
}
}
var action = hotkey _actions [ hotkey _action ] ;
if ( action != null ) {
action ( ) ;
return false ;
}
var action = hotkey _actions [ hotkey _action ] ;
} catch ( e ) {
exception _error ( "hotkey_handler" , e ) ;
if ( action != null ) {
action ( ) ;
return false ;
}
}
@ -965,33 +928,21 @@ function inPreferences() {
}
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 order _by = dijit . getEnclosingWidget ( toolbar . order _by ) ;
var toolbar = document . forms [ "main_toolbar_form" ] ;
var order _by = dijit . getEnclosingWidget ( toolbar . order _by ) ;
var value = order _by . attr ( 'value' ) ;
var value = order _by . attr ( 'value' ) ;
if ( value == "date_reverse" )
value = "default" ;
else
value = "date_reverse" ;
if ( value == "date_reverse" )
value = "default" ;
else
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 ) {
@ -1065,99 +1016,79 @@ function handle_rpc_json(transport, scheduled_call) {
else
notify _error ( "Communication problem with server." ) ;
console . log ( e ) ;
//exception_error("handle_rpc_json", e, transport);
console . error ( e ) ;
}
return true ;
}
function switchPanelMode ( wide ) {
try {
if ( isCdmMode ( ) ) return ;
article _id = getActiveArticleId ( ) ;
if ( isCdmMode ( ) ) return ;
if ( wide ) {
dijit . byId ( "headlines-wrap-inner" ) . attr ( "design" , 'sidebar' ) ;
dijit . byId ( "content-insert" ) . attr ( "region" , "trailing" ) ;
article _id = getActiveArticleId ( ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : '50%' ,
height : 'auto' ,
borderTopWidth : '0px' } ) ;
if ( parseInt ( getCookie ( "ttrss_ci_width" ) ) > 0 ) {
dijit . byId ( "content-insert" ) . domNode . setStyle (
{ width : getCookie ( "ttrss_ci_width" ) + "px" } ) ;
}
if ( wide ) {
dijit . byId ( "headlines-wrap-inner" ) . attr ( "design" , 'sidebar' ) ;
dijit . byId ( "content-insert" ) . attr ( "region" , "trailing" ) ;
$ ( "headlines-frame" ) . setStyle ( { borderBottomWidth : '0px' } ) ;
$ ( "headlines-frame" ) . addClassName ( "wide" ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : '50%' ,
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' ,
height : '50%' ,
borderTopWidth : '0px' } ) ;
} else {
if ( parseInt ( getCookie ( "ttrss_ci_height" ) ) > 0 ) {
dijit . byId ( "content-insert" ) . domNode . setStyle (
{ height : getCookie ( "ttrss_ci_height" ) + "px" } ) ;
}
dijit . byId ( "content-insert" ) . attr ( "region" , "bottom" ) ;
$ ( "headlines-frame" ) . setStyle ( { borderBottomWidth : '1px' } ) ;
$ ( "headlines-frame" ) . removeClassName ( "wide" ) ;
dijit . byId ( "content-insert" ) . domNode . setStyle ( { width : 'auto' ,
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" , {
parameters : "op=rpc&method=setpanelmode&wide=" + ( wide ? 1 : 0 ) ,
onComplete : function ( transport ) {
console . log ( transport . responseText ) ;
} } ) ;
closeArticlePanel ( ) ;
if ( article _id ) view ( article _id ) ;
} catch ( e ) {
exception _error ( "switchPanelMode" , e ) ;
}
new Ajax . Request ( "backend.php" , {
parameters : "op=rpc&method=setpanelmode&wide=" + ( wide ? 1 : 0 ) ,
onComplete : function ( transport ) {
console . log ( transport . responseText ) ;
} } ) ;
}
function update _random _feed ( ) {
try {
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 ) ;
} } ) ;
console . log ( "in update_random_feed" ) ;
} catch ( e ) {
exception _error ( "update_random_feed" , e ) ;
}
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 ) ;
} } ) ;
}
function hash _get ( key ) {
try {
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
return kv [ key ] ;
} catch ( e ) {
exception _error ( "hash_get" , e ) ;
}
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
return kv [ key ] ;
}
function hash _set ( key , value ) {
try {
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
kv [ key ] = value ;
window . location . hash = $H ( kv ) . toQueryString ( ) ;
} catch ( e ) {
exception _error ( "hash_set" , e ) ;
}
kv = window . location . hash . substring ( 1 ) . toQueryParams ( ) ;
kv [ key ] = value ;
window . location . hash = $H ( kv ) . toQueryString ( ) ;
}