TimelineFiltersCollection.js

From disqus.com, 2 Months ago, written in JavaScript, viewed 3 times. This paste is a reply to Router.js from disqus.com - view diff
URL https://pastebin.freepbx.org/view/410ec3af Embed
Download Paste or View Raw
  1. define('home/collections/TimelineFiltersCollection',[
  2.     'jquery',
  3.     'backbone',
  4.  
  5.     'core/api',
  6.  
  7.     'home/models/TimelineFilter',
  8. ], function (
  9.     $,
  10.     Backbone,
  11.  
  12.     api,
  13.  
  14.     Filter
  15. ) {
  16.     'use strict';
  17.  
  18.     return Backbone.Collection.extend({
  19.  
  20.         model: Filter,
  21.  
  22.         initialize: function (_items, options) {
  23.             options = options || {};
  24.             this.type = options.type;
  25.         },
  26.  
  27.         url: function () { return api.getURL('timelines/filters/list') + '?' + $.param({ type: this.type }); },
  28.  
  29.         addFilter: function (filterName) {
  30.             var exists = this.get(filterName);
  31.             if (!exists)
  32.                 exists = this.add({ id: filterName });
  33.             return exists.save();
  34.         },
  35.  
  36.         removeFilter: function (filterName) {
  37.             var exists = this.get(filterName);
  38.             if (!exists)
  39.                 exists = new Filter({ id: filterName });
  40.             return exists.destroy();
  41.         },
  42.  
  43.         parse: function (response) {
  44.             return response.response || response;
  45.         },
  46.     });
  47. });
  48.  
  49. // https://c.disquscdn.com/next/c0d8fa9/home/js/collections/TimelineFiltersCollection.js

Replies to TimelineFiltersCollection.js rss

Title Name Language When
welcome.js disqus.com javascript 2 Months ago.

Reply to "TimelineFiltersCollection.js"

Here you can reply to the paste above