PageRenderTime 27ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/index.html

https://bitbucket.org/titogelo/yahoo-pipes-with-backbone-bootstrap
HTML | 151 lines | 143 code | 8 blank | 0 comment | 0 complexity | 864f1572918e8bcb64644ca4003c4efb MD5 | raw file
  1. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  2. <meta charset="utf-8">
  3. <title>Backbase, Backbone & Yahoo pipes</title>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
  5. <script type="text/javascript" src="http://backbonejs.org/test/vendor/underscore.js"></script>
  6. <script type="text/javascript" src="http://backbonejs.org/backbone.js"></script>
  7. <script type="text/javascript">
  8. $(function(){
  9. var Pipe = Backbone.Model.extend();
  10. var Pipes = Backbone.Collection.extend({
  11. model: Pipe,
  12. parse: function(response, xhr) {
  13. return response.value.items.slice(0,10);
  14. }
  15. });
  16. var PipeView = Backbone.View.extend({
  17. el: $('.navbar-inner .container'),
  18. cont: $('.row-fluid'),
  19. initialize: function() {
  20. _.bindAll(this, 'addPipe');
  21. this.pipes = new Pipes();
  22. var that = this;
  23. this.counter = 0;
  24. this.pipes.url = 'http://pipes.yahoo.com/pipes/pipe.run?_id=DqsF_ZG72xGLbes9l7okhQ&_render=json&callback=news' ;
  25. this.pipes.fetch({
  26. success: function(response,xhr) {
  27. response.each(function(data) {
  28. that.counter += 1;
  29. //console.log(data)
  30. that.addPipe(data, that.counter);
  31. });
  32. },
  33. error: function (errorResponse) {
  34. console.log(errorResponse)
  35. }
  36. });
  37. },
  38. addPipe: function(item, i) {
  39. $(this.cont).append("<div class='span4'><h4>"+i+". "+item.get('title')+"</h4><p>" +item.get("description") + "</p><p><a href='" + item.get("link") + "'>Link</a></p></div>");
  40. if (i % 3 == 0) {
  41. $(this.cont).after("<div class='row-fluid r"+i+"'></div>");
  42. this.cont = $('.row-fluid.r'+i);
  43. };
  44. }
  45. });
  46. var pipeView = new PipeView();
  47. });
  48. </script>
  49. <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
  50. <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet">
  51. <style type="text/css">
  52. body {
  53. padding-top: 20px;
  54. padding-bottom: 60px;
  55. }
  56. /* Custom container */
  57. .container {
  58. margin: 0 auto;
  59. max-width: 1000px;
  60. }
  61. .container > hr {
  62. margin: 60px 0;
  63. }
  64. /* Main marketing message and sign up button */
  65. .jumbotron {
  66. margin: 80px 0;
  67. text-align: center;
  68. }
  69. .jumbotron h1 {
  70. font-size: 100px;
  71. line-height: 1;
  72. }
  73. .jumbotron .lead {
  74. font-size: 24px;
  75. line-height: 1.25;
  76. }
  77. .jumbotron .btn {
  78. font-size: 21px;
  79. padding: 14px 24px;
  80. }
  81. /* Supporting marketing content */
  82. .marketing {
  83. margin: 60px 0;
  84. }
  85. .marketing p + h4 {
  86. margin-top: 28px;
  87. }
  88. /* Customize the navbar links to be fill the entire space of the .navbar */
  89. .navbar .navbar-inner {
  90. padding: 0;
  91. }
  92. .navbar .nav {
  93. margin: 0;
  94. display: table;
  95. width: 100%;
  96. }
  97. .navbar .nav li {
  98. display: table-cell;
  99. width: 1%;
  100. float: none;
  101. }
  102. .navbar .nav li a {
  103. font-weight: bold;
  104. text-align: center;
  105. border-left: 1px solid rgba(255,255,255,.75);
  106. border-right: 1px solid rgba(0,0,0,.1);
  107. }
  108. .navbar .nav li:first-child a {
  109. border-left: 0;
  110. border-radius: 3px 0 0 3px;
  111. }
  112. .navbar .nav li:last-child a {
  113. border-right: 0;
  114. border-radius: 0 3px 3px 0;
  115. }
  116. </style>
  117. </head>
  118. <body>
  119. <div class="container">
  120. <div class="masthead">
  121. <h3 class="muted">Angel Suarez</h3>
  122. <div class="navbar">
  123. <div class="navbar-inner">
  124. <div class="container">
  125. <ul class="nav">
  126. <li class="active"><a href="#">Yahoo pipes exercise</a></li>
  127. <li><a href="http://www.backbase.com">Backbase's web</a></li>
  128. <li><a href="http://backbonejs.org/">Backbone's web</a></li>
  129. <li><a href="http://nl.linkedin.com/pub/%C3%A1ngel-su%C3%A1rez-fern%C3%A1ndez/23/58b/206/en">Personal Linkedin</a></li>
  130. </ul>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. <div class="row-fluid">
  136. </div>
  137. <hr>
  138. <div class="footer">
  139. <p>© Backbase 2013</p>
  140. </div>
  141. </div>
  142. </body>
  143. </html>