Permalink
Browse files

Adding required.js

  • Loading branch information...
1 parent ba6dc01 commit 62940e4c1822889157deb0c2d87cbb3e997d8756 @lukewilde committed Mar 24, 2012
Showing with 39 additions and 11 deletions.
  1. +3 −9 index.html
  2. +23 −0 js/newsding.js
  3. +11 −0 js/newsding/main.js
  4. +2 −2 js/newsding/newsding.js
View
@@ -13,10 +13,8 @@
<footer>ding.</footer>
- <script src="/js/jquery-1.7.1.min.js" type="text/javascript"></script>
- <script src="/js/jquery.tmpl.min.js" type="text/javascript"></script>
- <script src="/js/jquery-jfeed.js" type="text/javascript"></script>
- <script src="/js/newsding.js" type="text/javascript"></script>
+ </head>
+
</body>
<script id="news-item" type="text/x-jquery-tmpl">
@@ -26,9 +24,5 @@
<article>
</script>
- <script type="text/javascript">
- $(function(){
- $('body').newsding();
- });
- </script>
+ <script data-main="js/newsding/main" src="js/lib/require.js"></script>
</html>
View
@@ -0,0 +1,23 @@
+$(function(){
+
+ $.fn.newsding = function() {
+ var
+ base = this,
+ options = {
+ numRows: localStorage.numrows,
+ categories: $.parseJSON(localStorage.sources).categories
+ };
+
+ $(options.categories).each(function() {
+ $(this.items).each(function() {
+ console.log("woo");
+ // $.ajax({
+ // url: this.url,
+ // success: function(feed) {
+ // console.log(this, feed);
+ // }
+ // });
+ });
+ });
+ };
+});
View
@@ -0,0 +1,11 @@
+require([
+ '/js/lib/jquery-1.7.1.min.js',
+ '/js/lib/jquery.tmpl.min.js',
+ '/js/lib/jquery-jfeed.js',
+ '/js/newsding/newsding.js'
+],
+function($) {
+ jQuery(function($){
+ $('body').newsding();
+ });
+});
View
@@ -10,7 +10,7 @@ $(function(){
$(options.categories).each(function() {
$(this.items).each(function() {
-
+ console.log("woo");
// $.ajax({
// url: this.url,
// success: function(feed) {
@@ -20,4 +20,4 @@ $(function(){
});
});
};
-}(jQuery));
+});

0 comments on commit 62940e4

Please sign in to comment.