withThreadSharing.Js

From disqus.com, 2 Months ago, written in JavaScript, viewed 3 times. This paste is a reply to TabbedView.JS from disqus.com - view diff
URL https://pastebin.freepbx.org/view/d12efbdf Embed
Download Paste or View Raw
  1. define('home/mixins/withThreadSharing',[
  2.     'jquery',
  3.     'underscore',
  4. ], function (
  5.     $,
  6.     _
  7. ) {
  8.     'use strict';
  9.  
  10.     /**
  11.      * Default method for retrieving the thread off the model.
  12.      * Expects the model to have a direct relation to the thread
  13.      * (ex: activity, post), or be the thread itself.
  14.      *
  15.      * @returns {Thread}
  16.      */
  17.     var getThread = function () {
  18.         return this.model.thread || this.model;
  19.     };
  20.  
  21.     return function () {
  22.         this.events = _.extend({
  23.             'click [data-action=share]': 'handleShareThread',
  24.         }, this.events);
  25.  
  26.         this.handleShareThread = function (event) {
  27.             if (!event)
  28.                 return;
  29.  
  30.             event.preventDefault();
  31.             event.stopPropagation();
  32.  
  33.             var thread = getThread.call(this);
  34.             var network = $(event.currentTarget).attr('data-network');
  35.  
  36.             thread.shareThread(network);
  37.         };
  38.     };
  39. });
  40.  
  41. // https://c.disquscdn.com/next/home/js/mixins/withThreadSharing.js

Replies to withThreadSharing.Js rss

Title Name Language When
Re: withThreadSharing.Js disqus.com javascript 2 Months ago.

Reply to "withThreadSharing.Js"

Here you can reply to the paste above