View file upload/js/xenforo/follow.js

File size: 2.63Kb
/*
 * XenForo follow.min.js
 * Copyright 2010-2019 XenForo Ltd.
 * Released under the XenForo License Agreement: http://xenforo.com/license-agreement
 */
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,c){a instanceof String&&(a=String(a));for(var d=a.length,b=0;b<d;b++){var f=a[b];if(e.call(c,f,b,a))return{i:b,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,c){a!=Array.prototype&&a!=Object.prototype&&(a[e]=c.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,c,d){if(e){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var b=a[d];b in c||(c[b]={});c=c[b]}a=a[a.length-1];d=c[a];e=e(d);e!=d&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
!function(a,e,c,d){XenForo.UnfollowLink=function(a){this.__construct(a)};XenForo.UnfollowLink.prototype={__construct:function(b){this.$link=b.click(a.context(this,"eClick"));this.userId=b.data("userid");this.jsonUrl=b.data("jsonurl")||b.attr("href");if(null===this.userId||null===this.jsonUrl)return console.warn("Unfollow link found without userId or url defined. %o",b),!1;this.$container=a("#user_list_"+this.userId)},eClick:function(a){a.preventDefault();this.stopFollowing()},stopFollowing:function(){XenForo.ajax(this.jsonUrl,
{user_id:this.userId,_xfConfirm:1},a.context(this,"stopFollowingSuccess"))},stopFollowingSuccess:function(a,c){if(XenForo.hasResponseError(a))return!1;this.$container.xfRemove()}};XenForo.FollowForm=function(a){this.__construct(a)};XenForo.FollowForm.prototype={__construct:function(b){this.$form=b.bind("AutoValidationComplete",a.context(this,"ajaxCallback"));this.$userInputField=this.$form.find(this.$form.data("userinputfield"))},ajaxCallback:function(b){b.preventDefault();if(XenForo.hasResponseError(b.ajaxData))return!1;
var c=b.ajaxData.userIds.split(","),e=null,d;this.$userInputField.val("").focus();for(d=0;d<c.length;d++)0==this.$form.find("#user_list_"+c[d]).length&&($templateHtml=a(b.ajaxData.users[c[d]]),e?$templateHtml.xfInsert("insertAfter",e):$templateHtml.xfInsert("prependTo",".FollowList")),e="#user_list_"+c[d]}};XenForo.register("a.UnfollowLink","XenForo.UnfollowLink");XenForo.register("form.FollowForm","XenForo.FollowForm")}(jQuery,this,document);