├── CNAME ├── images ├── gif.gif ├── red.gif ├── wiki.png ├── github.png ├── loader.gif ├── wiki-logo.png └── wikifeedia.png ├── app └── Wikifeedia.apk ├── static ├── images │ ├── gif.gif │ ├── red.gif │ ├── wiki.png │ ├── github.png │ └── loader.gif ├── rest.html ├── style.css └── homepage.js ├── LICENSE ├── README.md └── index.html /CNAME: -------------------------------------------------------------------------------- 1 | wikifeedia.vishnuks.com -------------------------------------------------------------------------------- /images/gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/gif.gif -------------------------------------------------------------------------------- /images/red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/red.gif -------------------------------------------------------------------------------- /images/wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/wiki.png -------------------------------------------------------------------------------- /app/Wikifeedia.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/app/Wikifeedia.apk -------------------------------------------------------------------------------- /images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/github.png -------------------------------------------------------------------------------- /images/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/loader.gif -------------------------------------------------------------------------------- /images/wiki-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/wiki-logo.png -------------------------------------------------------------------------------- /images/wikifeedia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/images/wikifeedia.png -------------------------------------------------------------------------------- /static/images/gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/static/images/gif.gif -------------------------------------------------------------------------------- /static/images/red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/static/images/red.gif -------------------------------------------------------------------------------- /static/images/wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/static/images/wiki.png -------------------------------------------------------------------------------- /static/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/static/images/github.png -------------------------------------------------------------------------------- /static/images/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerkid/Wikifeedia/HEAD/static/images/loader.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Vishnu Ks 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | ## How it works? 6 | 7 | ![alt tag](images/gif.gif) 8 | 9 | The home page of Wikifeedia consist of a news feed of Featured articles. Featured articles are considered to be the best articles in Wikipedia. As of now there is no API for getting a list of featured articles that changes each time one make a request. To facilitate this I had to to make a new API server along with some Javascript tweaks. 10 | 11 | The backend of Wikifeedia can be found [here](https://github.com/hackerkid/Wikifeedia-backend). 12 | 13 | ## Installation 14 | ``` 15 | git clone https://github.com/hackerkid/Wikifeedia/ 16 | cd Wikifeedia 17 | python -m SimpleHTTPServer 18 | ``` 19 | Now browse to http://localhost:8000 . 20 | 21 | Equivalent python3 command is `python3 -m http.server` 22 | 23 | 24 | ## Contributing 25 | Your code goes live the moment it gets merged. Excited? Here is a small list of ToDos you can start working right now. 26 | 27 | ### TODO 28 | * Improve the UI. 29 | * The search results can be improved. 30 | * Custom home page 31 | * Implement any MV* framework ( preferably Backbone / React ) 32 | 33 | Your own ideas are also welcome as pull requests. 34 | -------------------------------------------------------------------------------- /static/rest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 16 | 17 | 18 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /static/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top: 50px; 3 | font-family: sans-serif; 4 | } 5 | 6 | .navbar .brand { max-height: 40px; overflow: visible;padding-top: 0;padding-bottom: 0; } 7 | #message { 8 | color: #337AB7; 9 | text-decoration: underline; 10 | cursor: pointer; 11 | } 12 | #catstyle { 13 | background-color: #F1F8FB; 14 | border-radius: 3px; 15 | color: #black; 16 | font-size: 16px; 17 | padding: 3px; 18 | display:inline-block; 19 | border: 1px solid #BBCADC; 20 | } 21 | 22 | 23 | #category { 24 | line-height: 1.2em; 25 | font-size: 12px; 26 | font-weight: 500; 27 | color: #fff; 28 | cursor: pointer; 29 | word-wrap: break-word; 30 | border-radius: 6px; 31 | text-decoration: none; 32 | margin-top: 3px; 33 | display: inline-block; 34 | margin-right: 5px; 35 | } 36 | 37 | #cattitle { 38 | color: #337AB7; 39 | cursor: pointer; 40 | 41 | } 42 | 43 | #feed img{ 44 | margin:20px 10px 10px 0px; 45 | } 46 | 47 | .feed_post{ 48 | border-bottom:1px solid #eee; 49 | margin-bottom:40px; 50 | } 51 | 52 | .feed_post h2 a, .feed_post h2 a:hover{ 53 | color:#777; 54 | text-decoration: none; 55 | } 56 | .feed_post h2 a:hover{ 57 | color:#444; 58 | } 59 | #progress { 60 | position: fixed; 61 | z-index: 2147483647; 62 | top: 0; 63 | left: -6px; 64 | width: 1%; 65 | height: 2px; 66 | background: #337AB7; 67 | -moz-border-radius: 1px; 68 | -webkit-border-radius: 1px; 69 | border-radius: 1px; 70 | -moz-transition: width 500ms ease-out, opacity 400ms linear; 71 | -ms-transition: width 500ms ease-out, opacity 400ms linear; 72 | -o-transition: width 500ms ease-out, opacity 400ms linear; 73 | -webkit-transition: width 500ms ease-out, opacity 400ms linear; 74 | transition: width 500ms ease-out, opacity 400ms linear; 75 | } 76 | 77 | #progress dd, 78 | #progress dt { 79 | position: absolute; 80 | top: 0; 81 | height: 2px; 82 | -moz-box-shadow: #337AB7 1px 0 6px 1px; 83 | -ms-box-shadow: #337AB7 1px 0 6px 1px; 84 | -webkit-box-shadow: #337AB7 1px 0 6px 1px; 85 | box-shadow: #337AB7 1px 0 6px 1px; 86 | -moz-border-radius: 100%; 87 | -webkit-border-radius: 100%; 88 | border-radius: 100%; 89 | } 90 | 91 | #progress dt { 92 | opacity: .6; 93 | width: 180px; 94 | right: -80px; 95 | clip: rect(-6px, 90px, 14px, -6px); 96 | } 97 | 98 | #progress dd { 99 | opacity: .6; 100 | width: 20px; 101 | right: 0; 102 | clip: rect(-6px, 22px, 14px, 10px); 103 | } 104 | 105 | .post_header{ 106 | padding:10px; 107 | text-align:center; 108 | } 109 | 110 | .label a{ 111 | color:white; 112 | } 113 | 114 | .navbar-default{ 115 | background-image:none; 116 | background:white; 117 | } 118 | 119 | .navbar-form .input-group-addon { 120 | background-color: #fff; 121 | border-radius: 0px; 122 | border-right:0px; 123 | } 124 | 125 | .navbar-form .form-control { 126 | border-radius: 0px; 127 | border-left: 0px; 128 | } 129 | 130 | #wiki-logo { 131 | position: relative; 132 | top: -9px; 133 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Wikifeedia - Wikipedia delivered as a Newsfeed 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 |
37 | 38 | 39 | 40 | 80 | 81 | 82 | 83 |
84 |
85 | 86 |
87 | 90 | 91 |
92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /static/homepage.js: -------------------------------------------------------------------------------- 1 | var category_of_page = 'featured_articles' 2 | 3 | var heroku_url = 'https://wikifeedia.herokuapp.com/index.php?category=' + category_of_page + '&callback=?' 4 | var hex_code = [] 5 | 6 | 7 | //retrieve posts randomly 8 | function retrive_posts() { 9 | 10 | if ($("#progress").length === 0) { 11 | $("body").append($("
").attr("id", "progress")); 12 | $("#progress").width((50 + Math.random() * 30) + "%"); 13 | } 14 | 15 | $.getJSON(urlContent, function(data) { 16 | next = data.continue.gcmcontinue 17 | 18 | $.each(data.query.pages, function(i, item) { 19 | content = item.extract 20 | pageId = item.pageid 21 | colum = 'post' + pageId 22 | catId = 'cat' + pageId 23 | imageHolder = 'image' + pageId 24 | 25 | if ($('#' + colum).length == 0) { 26 | $('#feed').append('
') 27 | 28 | if ($('#' + colum + ' h2').length == 0) { 29 | if (item.title.indexOf("Category:") != -1) { 30 | item.title = item.title.replace("Category:", "
Category

") 31 | item.title = item.title + "" 32 | } else { 33 | temp_url = "https://en.wikipedia.org/wiki/" + item.title; 34 | temp_url = encodeURI(temp_url); 35 | item.title = "" + item.title + ""; 36 | } 37 | 38 | 39 | $('#' + colum).append('

' + item.title + '

') 40 | } 41 | 42 | if ($('#' + catId).length == 0) { 43 | $('#' + colum).append('

') 44 | } 45 | 46 | if ($('#' + imageHolder).length == 0) { 47 | $('#' + colum).append('

') 48 | fetchImage(pageId) 49 | 50 | } 51 | 52 | if ($('#' + colum + ' p').length == 0) { 53 | $('#' + colum).append('

' + content + '

') 54 | $('#feed').append('

') 55 | fetchCat(pageId) 56 | } 57 | 58 | } 59 | 60 | }) 61 | 62 | $('div#loadmoreajaxloader').hide() 63 | $("#progress").width("101%").delay(200).fadeOut(400, function() { 64 | $(this).remove(); 65 | }); 66 | 67 | 68 | }) 69 | } 70 | 71 | function loadStartIndex() { 72 | $.getJSON(heroku_url, function(data) { 73 | start_page = data.category 74 | start_page_cleaned = start_page.replace('_', ' ') 75 | start_page_cleaned = start_page.toUpperCase() 76 | 77 | 78 | for (var i = 0; i < start_page_cleaned.length; i++) { 79 | hex_code = hex_code + start_page_cleaned.charCodeAt(i).toString(16) 80 | } 81 | 82 | start_url = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=categories&titles=' + start_page + '&callback=?' 83 | 84 | $.getJSON(start_url, function(data) { 85 | $.each(data.query.pages, function(i, item) { 86 | start_id = item.pageid 87 | next = 'page|' + hex_code + '|' + start_id 88 | fetchInitialPost() 89 | 90 | }) 91 | 92 | console.log(next) 93 | 94 | }) 95 | 96 | }) 97 | 98 | } 99 | 100 | function fetchInitialPost() { 101 | urlContent = 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=random&generator=categorymembers&gcmtitle=Category:' + category_of_page + '&prop=info&prop=extracts&exintro=&explaintext&exlimit=max&continue=gcmcontinue||random&rnlimit=10&rnnamespace=0&gcmcontinue=' + next + '&continue=&callback=?' 102 | retrive_posts(); 103 | 104 | 105 | return 1 106 | } 107 | 108 | function fetchImage(pageId) { 109 | urlImage = 'https://en.wikipedia.org/w/api.php?action=query&pageids=' + pageId + '&prop=pageimages&format=json&pithumbsize=500&continue=&callback=?' 110 | 111 | $.getJSON(urlImage, function(data) { 112 | $.each(data.query.pages, function(i, item) { 113 | content = item.thumbnail.source 114 | colum = 'image' + pageId 115 | $('#' + colum).append("Chronologically
') 136 | $('div#loadmoreajaxloader').show() 137 | urlContent = 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=random&generator=categorymembers&gcmtitle=Category:' + category_of_page + '&prop=info&prop=extracts&exintro=&explaintext&exlimit=max&continue=gcmcontinue||random&rnlimit=10&rnnamespace=0&continue=&callback=?' 138 | retrive_posts(); 139 | //loadStartIndex() 140 | }) 141 | 142 | */ 143 | $('#search_input').bind("enterKey", function(e) { 144 | var search_input = $("#search_input").val() 145 | console.log(search_input) 146 | category_of_page = search_input 147 | 148 | $('#feed').html('') 149 | $('#feed').append('
Showing results for ' + category_of_page + ' Chronologically.

') 150 | $('div#loadmoreajaxloader').show() 151 | urlContent = 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=random&generator=categorymembers&gcmtitle=Category:' + category_of_page + '&prop=info&prop=extracts&exintro=&explaintext&exlimit=max&continue=gcmcontinue||random&rnlimit=10&rnnamespace=0&continue=&callback=?' 152 | retrive_posts(); 153 | }); 154 | 155 | $('#search_input').keyup(function(e) { 156 | if (e.keyCode == 13) { 157 | $(this).trigger("enterKey"); 158 | } 159 | }); 160 | 161 | 162 | 163 | $('#feed').on('click', 'span', function() { 164 | 165 | 166 | if ($(this).text() == "Chronologically") { 167 | $('#feed').html('') 168 | $('#feed').append('
Showing results for ' + category_of_page + ' Randomly.

') 169 | $('div#loadmoreajaxloader').show() 170 | loadStartIndex(); 171 | 172 | } else { 173 | 174 | 175 | if ($(this).text() != "Randomly") { 176 | category_of_page = $(this).text() 177 | $("#search_input").val(category_of_page) 178 | } 179 | 180 | $('#feed').html('') 181 | $('#feed').append('
Showing results for ' + category_of_page + ' Chronologically.

') 182 | 183 | $('div#loadmoreajaxloader').show() 184 | urlContent = 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=random&generator=categorymembers&gcmtitle=Category:' + category_of_page + '&prop=info&prop=extracts&exintro=&explaintext&exlimit=max&continue=gcmcontinue||random&rnlimit=10&rnnamespace=0&continue=&callback=?' 185 | retrive_posts(); 186 | } 187 | //loadStartIndex() 188 | }) 189 | 190 | }) 191 | 192 | $(window).scroll(function() { 193 | if ($(window).scrollTop() == $(document).height() - $(window).height()) { 194 | data = 0 195 | urlContent = 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=random&generator=categorymembers&gcmtitle=Category:' + category_of_page + '&prop=info&prop=extracts&exintro=&explaintext&exlimit=max&continue=gcmcontinue||random&rnlimit=10&rnnamespace=0&gcmcontinue=' + next + '&continue=&callback=?' 196 | 197 | $('div#loadmoreajaxloader').show() 198 | retrive_posts(); 199 | } 200 | }) 201 | 202 | function getUrlVars() { 203 | var vars = {} 204 | var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) { 205 | vars[key] = value 206 | }) 207 | return vars 208 | } 209 | 210 | function fetchCat(pageId) { 211 | ul = 'https://en.wikipedia.org/w/api.php?action=query&format=json&grnlimit=max&exlimit=max&prop=categories&pageids=' + pageId + '&continue=&callback=?' 212 | 213 | $.getJSON(ul, function(data) { 214 | $.each(data.query.pages, function(i, item) { 215 | k = 0 216 | $.each(item.categories, function(j, cat) { 217 | catId = 'cat' + pageId 218 | catile = cat.title 219 | catile = catile.replace('Category:', '') 220 | if ((catile.match(/articles/g) || []).length == 0 && (catile.match(/Articles/g) || []).length == 0 && (catile.match(/Pages/g) || []).length == 0 && (catile.match(/Article/g) || []).length == 0 && (catile.match(/category/g) || []).length == 0 && (catile.match(/pages/g) || []).length == 0 && k < 5) { 221 | k++ 222 | $('#' + catId).append("" + catile + '  ') 223 | 224 | } 225 | 226 | }) 227 | 228 | }) 229 | }) 230 | 231 | } 232 | --------------------------------------------------------------------------------