diff options
author | Adam Mathes <adam@trenchant.org> | 2018-04-27 15:52:00 -0700 |
---|---|---|
committer | Adam Mathes <adam@trenchant.org> | 2018-04-27 15:52:00 -0700 |
commit | 5068ca5c0d88694ec1c25dce81c747d5cfa6b54e (patch) | |
tree | 644bfb34b8525dbb7077ea5b2a3f5a1e24512b82 /static | |
parent | b773d3b1fa1ca4e01b100eb5e89b88b8347740ce (diff) | |
download | neko-5068ca5c0d88694ec1c25dce81c747d5cfa6b54e.tar.gz neko-5068ca5c0d88694ec1c25dce81c747d5cfa6b54e.tar.bz2 neko-5068ca5c0d88694ec1c25dce81c747d5cfa6b54e.zip |
separator for scrape
Diffstat (limited to 'static')
-rw-r--r-- | static/ui.html | 5 | ||||
-rw-r--r-- | static/ui.js | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/static/ui.html b/static/ui.html index 89283a4..cae2c56 100644 --- a/static/ui.html +++ b/static/ui.html @@ -38,11 +38,12 @@ <script id="item_template" type="text/jqtmp"> <h2><a target="_blank" class="i" id="i_${item_id}" href="${item.url}">${item.title }</a> <span class={{if item.starred}}"unstar"{{else}}"star"{{/if}}>★</span> - <span class="full">{{if item.full}}▼{{else}}►{{/if}}</span> </h2> <p class="dateline" style="clear: both;"> <a href="${item.feed_url}">${item.feed_title}</a> | <a href="${item.url}">${item.p_url}</a> - | ${item.feed_category} + | ${item.feed_category} | + <span class="full">{{if item.full}}hide{{else}}scrape{{/if}} full text</span> + </p> {{if item.header_image}} <div class="img"><img src="${item.header_image}" /></div> diff --git a/static/ui.js b/static/ui.js index 0c60630..4e6d7e0 100644 --- a/static/ui.js +++ b/static/ui.js @@ -208,7 +208,7 @@ var ControlsView = Backbone.View.extend({ var Item = Backbone.Model.extend({ idAttribute: "_id", - url: '/item/', + url: '/item', initialize: function() { var p_url = this.get('url'); @@ -252,6 +252,16 @@ var Item = Backbone.Model.extend({ full: function() { this.set({'full': !(this.get('full'))} ); + // this should just use this.fetch() but + // it kept GETing from /item instead of /item/id + // so just hacking this in for now + + if(this.get('full_content') == "") { + $.getJSON('/item/' + this.get('_id'), function(data) { + var i = App.items.get(data['_id']) + i.set('full_content', data['full_content']); + }); + } } }); @@ -259,6 +269,8 @@ var Item = Backbone.Model.extend({ var ItemCollection = Backbone.Collection.extend({ model: Item, + url: '/item', + initialize: function() { _.bindAll(this, 'boot', 'reboot'); }, |