Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var modify = function (o) {
  2.     o.data.forEach(function (comment) {
  3.         /*
  4.         * Comment object format:
  5.         * {
  6.         *   created_at :"hours minutes",
  7.         *   id: ID,
  8.         *   index: INDEX,
  9.         *   is_mine: BOOLEAN,
  10.         *   msg: "MESSAGE",
  11.         *   user_avatar: "https://s3.amazonaws.com/em-uploads/avatars/USERID_thumb.jpg",
  12.         *   user_exists: BOOLEAN,
  13.         *   user_id: USER_ID,
  14.         *   user_username: "USER_NAME",
  15.         *   vote: VOTE_SUM
  16.         * }
  17.         */
  18.     });
  19.     return o;
  20. };
  21.  
  22. unsafeWindow.loadpage = function (original) {
  23.     return function () {
  24.         var oldArgs = arguments;
  25.         unsafeWindow.fetch_template('comment.html', 'comment', function(tmpl) {
  26.             if (oldArgs[1].indexOf("/comment/find/") == 0) {
  27.                 oldArgs[4] = function (o) {
  28.                     o = modify(o);
  29.                     return tmpl(o);
  30.                 };
  31.             }
  32.             original.apply(this, oldArgs);
  33.         });
  34.     };
  35. }(unsafeWindow.loadpage);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement