javascript_vars.phtml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. echo '"use strict";', "\n";
  3. $mark = $this->conf->mark_when;
  4. echo 'var ',
  5. 'hide_posts=', ($this->conf->display_posts || Minz_Request::param('output') === 'reader') ? 'false' : 'true',
  6. ',display_order="', Minz_Request::param('order', $this->conf->sort_order), '"',
  7. ',auto_mark_article=', $mark['article'] ? 'true' : 'false',
  8. ',auto_mark_site=', $mark['site'] ? 'true' : 'false',
  9. ',auto_mark_scroll=', $mark['scroll'] ? 'true' : 'false',
  10. ',auto_load_more=', $this->conf->auto_load_more ? 'true' : 'false',
  11. ',does_lazyload=', $this->conf->lazyload ? 'true' : 'false',
  12. ',sticky_post=', $this->conf->sticky_post ? 'true' : 'false';
  13. $s = $this->conf->shortcuts;
  14. echo ',shortcuts={',
  15. 'mark_read:"', $s['mark_read'], '",',
  16. 'mark_favorite:"', $s['mark_favorite'], '",',
  17. 'go_website:"', $s['go_website'], '",',
  18. 'prev_entry:"', $s['prev_entry'], '",',
  19. 'next_entry:"', $s['next_entry'], '",',
  20. 'first_entry:"', $s['first_entry'], '",',
  21. 'last_entry:"', $s['last_entry'], '",',
  22. 'collapse_entry:"', $s['collapse_entry'], '",',
  23. 'load_more:"', $s['load_more'], '",',
  24. 'auto_share:"', $s['auto_share'], '",',
  25. 'focus_search:"', $s['focus_search'], '"',
  26. "},\n";
  27. if (Minz_Request::param ('output') === 'global') {
  28. echo "iconClose='", FreshRSS_Themes::icon('close'), "',\n";
  29. }
  30. $authType = Minz_Configuration::authType();
  31. if ($authType === 'persona') {
  32. // If user is disconnected, current_user_mail MUST be null
  33. $mail = Minz_Session::param ('mail', false);
  34. if ($mail) {
  35. echo 'current_user_mail="' . $mail . '",';
  36. } else {
  37. echo 'current_user_mail=null,';
  38. }
  39. }
  40. echo 'authType="', $authType, '",',
  41. 'url_freshrss="', _url ('index', 'index'), '",',
  42. 'url_login="', _url ('index', 'login'), '",',
  43. 'url_logout="', _url ('index', 'logout'), '",';
  44. echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n";
  45. $autoActualise = Minz_Session::param('actualize_feeds', false);
  46. echo 'auto_actualize_feeds=', $autoActualise ? 'true' : 'false', ";\n";