javascript_vars.phtml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. "use strict";
  2. <?php
  3. $mark = FreshRSS_Context::$conf->mark_when;
  4. $mail = Minz_Session::param('mail', false);
  5. $auto_actualize = Minz_Session::param('actualize_feeds', false);
  6. $hide_posts = (FreshRSS_Context::$conf->display_posts ||
  7. Minz_Request::param('output') === 'reader');
  8. $s = FreshRSS_Context::$conf->shortcuts;
  9. $url_login = Minz_Url::display(array(
  10. 'c' => 'auth',
  11. 'a' => 'login'
  12. ), 'php');
  13. $url_logout = Minz_Url::display(array(
  14. 'c' => 'auth',
  15. 'a' => 'logout'
  16. ), 'php');
  17. echo 'var context={',
  18. 'auto_remove_article:', FreshRSS_Context::isAutoRemoveAvailable() ? 'true' : 'false', ',',
  19. 'hide_posts:', $hide_posts ? 'false' : 'true', ',',
  20. 'display_order:"', Minz_Request::param('order', FreshRSS_Context::$conf->sort_order), '",',
  21. 'auto_mark_article:', $mark['article'] ? 'true' : 'false', ',',
  22. 'auto_mark_site:', $mark['site'] ? 'true' : 'false', ',',
  23. 'auto_mark_scroll:', $mark['scroll'] ? 'true' : 'false', ',',
  24. 'auto_load_more:', FreshRSS_Context::$conf->auto_load_more ? 'true' : 'false', ',',
  25. 'auto_actualize_feeds:', $auto_actualize ? 'true' : 'false', ',',
  26. 'does_lazyload:', FreshRSS_Context::$conf->lazyload ? 'true' : 'false', ',',
  27. 'sticky_post:', FreshRSS_Context::isStickyPostEnabled() ? 'true' : 'false', ',',
  28. 'html5_notif_timeout:', FreshRSS_Context::$conf->html5_notif_timeout, ',',
  29. 'auth_type:"', Minz_Configuration::authType(), '",',
  30. 'current_user_mail:', $mail ? ('"' . $mail . '"') : 'null', ',',
  31. 'current_view:"', Minz_Request::param('output', 'normal'), '"',
  32. "},\n";
  33. echo 'shortcuts={',
  34. 'mark_read:"', $s['mark_read'], '",',
  35. 'mark_favorite:"', $s['mark_favorite'], '",',
  36. 'go_website:"', $s['go_website'], '",',
  37. 'prev_entry:"', $s['prev_entry'], '",',
  38. 'next_entry:"', $s['next_entry'], '",',
  39. 'first_entry:"', $s['first_entry'], '",',
  40. 'last_entry:"', $s['last_entry'], '",',
  41. 'collapse_entry:"', $s['collapse_entry'], '",',
  42. 'load_more:"', $s['load_more'], '",',
  43. 'auto_share:"', $s['auto_share'], '",',
  44. 'focus_search:"', $s['focus_search'], '",',
  45. 'user_filter:"', $s['user_filter'], '",',
  46. 'help:"', $s['help'], '",',
  47. 'close_dropdown:"', $s['close_dropdown'], '"',
  48. "},\n";
  49. echo 'url={',
  50. 'index:"', _url('index', 'index'), '",',
  51. 'login:"', $url_login, '",',
  52. 'logout:"', $url_logout, '",',
  53. 'help:"', FRESHRSS_WIKI, '"',
  54. "},\n";
  55. echo 'i18n={',
  56. 'confirmation_default:"', _t('confirm_action'), '",',
  57. 'notif_title_articles:"', _t('notif_title_new_articles'), '",',
  58. 'notif_body_articles:"', _t('notif_body_new_articles'), '",',
  59. 'category_empty:"', _t('category_empty'), '"',
  60. "},\n";
  61. echo 'icons={',
  62. 'close:\'', _i('close'), '\'',
  63. "}\n";