Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // for github.com/S0lll0s/imgimp
- // usage: nfsfw: [albumid/rss link]
- // installation: copy link in index.html, update relative to this file
- function GenericRssFeed( url ) {
- Feed.call( this, url );
- this.url = (/^rss: (.+)$/i).exec( this.url )[1]
- this.imageexpr = /src="(.+?\.(jpg|png|gif|jpeg))"/i;
- this.loaded = false;
- }
- GenericRssFeed.prototype.createDOM = function () {
- return '<li class="feed"><div class="spacer"><a class="feed-link feed-remove"><i class="fa fa-times fa-3x"></i></a></div><div class="rss">' + this.url + '</div></li>'
- };
- GenericRssFeed.prototype.loadMore = function () {
- if ( this.loaded )
- return true;
- console.log( '[GRSS]: updating...' );
- var $this = this;
- return $.getFeed({
- url: this.url,
- crossDomain: true,
- success: function( feed ) {
- var i = 0;
- for ( i = 0; i < feed.items.length; i++ ) {
- var item = feed.items[i];
- if ( !$this.imageexpr.test( item.description ) )
- continue;
- $this.images.push({
- 'title': item.title,
- 'imgurl': $this.imageexpr.exec(item.description)[1],
- 'descurl': item.link,
- 'feed': $this,
- 'date': new Date( item.updated )
- });
- }
- console.log( '[GRSS]: +'+i+'['+$this.images.length+']');
- $this.loaded = true;
- },
- error: function( e ) {
- console.log( e.message );
- }
- });
- };
- types.push({
- name: 'genericrss',
- regex: /^rss: (.+)$/i,
- func: GenericRssFeed
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement