You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.6 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. FeedViewer = {};
  16. Ext.onReady(function(){
  17. Ext.QuickTips.init();
  18. Ext.state.Manager.setProvider(new Ext.state.SessionProvider({state: Ext.appState}));
  19. var tpl = Ext.Template.from('preview-tpl', {
  20. compiled:true,
  21. getBody : function(v, all){
  22. return Ext.util.Format.stripScripts(v || all.description);
  23. }
  24. });
  25. FeedViewer.getTemplate = function(){
  26. return tpl;
  27. }
  28. var feeds = new FeedPanel();
  29. var mainPanel = new MainPanel();
  30. feeds.on('feedselect', function(feed){
  31. mainPanel.loadFeed(feed);
  32. });
  33. var viewport = new Ext.Viewport({
  34. layout:'border',
  35. items:[
  36. new Ext.BoxComponent({ // raw element
  37. region:'north',
  38. el: 'header',
  39. height:32
  40. }),
  41. feeds,
  42. mainPanel
  43. ]
  44. });
  45. // add some default feeds
  46. feeds.addFeed({
  47. url:'http://feeds.feedburner.com/extblog',
  48. text: 'ExtJS.com Blog'
  49. }, false, true);
  50. feeds.addFeed({
  51. url:'http://extjs.com/forum/external.php?type=RSS2',
  52. text: 'ExtJS.com Forums'
  53. }, true);
  54. feeds.addFeed({
  55. url:'http://feeds.feedburner.com/ajaxian',
  56. text: 'Ajaxian'
  57. }, true);
  58. Ext.get('header').on('click', function() {
  59. viewport.focus();
  60. });
  61. feeds.focus();
  62. });
  63. // This is a custom event handler passed to preview panels so link open in a new windw
  64. FeedViewer.LinkInterceptor = {
  65. render: function(p){
  66. p.body.on({
  67. 'mousedown': function(e, t){ // try to intercept the easy way
  68. t.target = '_blank';
  69. },
  70. 'click': function(e, t){ // if they tab + enter a link, need to do it old fashioned way
  71. if(String(t.target).toLowerCase() != '_blank'){
  72. e.stopEvent();
  73. window.open(t.href);
  74. }
  75. },
  76. delegate:'a'
  77. });
  78. }
  79. };