PageSourceSearch

https://galgame.dev/assets/modules/accounts-picture.992a3abcd8408f9077ce.min.js

js galgame.dev collected 2026-10-01 13:12:24 UTC 10,893 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunknodebb=self.webpackChunknodebb||[]).push([[1091,16852,34271,43400,49897,99127],{7524:(D,C,c)=>{var m,y;m=[c(72254),c(49897),c(33530),c(29930)],y=((p,x,v,d)=>{const f={};f.openChangeModal=()=>{socket.emit("user.getProfilePictures",{uid:ajaxify.data.uid},function(a,r){if(a)return d.error(a);const s=r.reduce(function(o,e){return o||e.type==="uploaded"},!1);app.parseAndTranslate("modals/change-picture",{pictures:r,uploaded:s,icon:{text:ajaxify.data["icon:text"],bgColor:ajaxify.data["icon:bgColor"]},defaultAvatar:ajaxify.data.defaultAvatar,allowProfileImageUploads:ajaxify.data.allowProfileImageUploads,iconBackgrounds:ajaxify.data.iconBackgrounds,user:{uid:ajaxify.data.uid,username:ajaxify.data.username,picture:ajaxify.data.picture,"icon:text":ajaxify.data["icon:text"],"icon:bgColor":ajaxify.data["icon:bgColor"]}},function(o){const e=v.dialog({className:"picture-switcher",title:"[[user:change-picture]]",message:o,show:!0,size:"large",buttons:{close:{label:"[[global:close]]",callback:g,className:"btn-link"},update:{label:"[[global:save-changes]]",callback:n}}});e.on("shown.bs.modal",i),e.on("click",".list-group-item",function(){e.find(".list-group-item").removeClass("active"),$(this).addClass("active")}),e.on("click","[data-bg-color]",function(){const u=$(this).attr("data-bg-color");$(this).addClass("selected").siblings().removeClass("selected"),e.find('[component="avatar/icon"]').css("background-color",u)}),t(e);function i(){ajaxify.data.picture?e.find(".list-group-item img").each(function(){this.getAttribute("src")===ajaxify.data.picture&&$(this).parents(".list-group-item").addClass("active")}):e.find('[data-type="default"]').addClass("active");const u=e.find(`[data-bg-color="${ajaxify.data["icon:bgColor"]}"]`);u.length?u.addClass("selected"):e.find('[data-bg-color="transparent"]').addClass("selected")}function n(){const u=e.find(".list-group-item.active").attr("data-type"),b=e.find("[data-bg-color].selected").attr("data-bg-color")||"transparent";l(u,b).then(()=>{f.updateHeader(u==="default"?"":e.find(".list-group-item.active img").attr("src"),b),ajaxify.refresh()}).catch(d.error)}function g(){e.modal("hide")}})})},f.updateHeader=(a,r)=>{if(parseInt(ajaxify.data.theirid,10)!==parseInt(ajaxify.data.yourid,10))return;!a&&ajaxify.data.defaultAvatar&&(a=ajaxify.data.defaultAvatar);const s=$('[component="header/avatar"] [component="avatar/picture"]'),o=$('[component="header/avatar"] [component="avatar/icon"]');if(a){if(!s.length&&o.length){const e=$("<img/>");$(o[0].attributes).each(function(){e.attr(this.nodeName,this.nodeValue)}),e.attr("component","avatar/picture").attr("src",a).insertBefore(o)}}else s.remove();r&&o.css({"background-color":r})};function t(a){function r(o){o=(o.startsWith("http")?"":config.relative_path)+o;const e=o+"?"+Date.now();f.updateHeader(e),ajaxify.data.picture&&ajaxify.data.picture.length?($(`#user-current-picture, img[data-uid="${ajaxify.data.theirid}"].avatar`).attr("src",e),ajaxify.data.uploadedpicture=o,ajaxify.data.picture=o):ajaxify.refresh(function(){$(`#user-current-picture, img[data-uid="${ajaxify.data.theirid}"].avatar`).attr("src",e)})}function s(){ajaxify.data.uploadedpicture===ajaxify.data.picture&&(ajaxify.refresh(),f.updateHeader())}a.find('[data-action="upload"]').on("click",function(){return a.modal("hide"),p.show({socketMethod:"user.uploadCroppedPicture",route:config.relative_path+"/api/user/"+ajaxify.data.userslug+"/uploadpicture",aspectRatio:1/1,paramName:"uid",paramValue:ajaxify.data.theirid,fileSize:ajaxify.data.maximumProfileImageSize,allowSkippingCrop:!1,title:"[[user:upload-picture]]",description:"[[user:upload-a-picture]]",accept:ajaxify.data.allowedProfileImageExtensions},function(o){r(o)}),!1}),a.find('[data-action="upload-url"]').on("click",function(){return a.modal("hide"),app.parseAndTranslate("modals/upload-picture-from-url",{},function(o){o.modal("show"),o.find(".upload-btn").on("click",function(){const e=o.find("#uploadFromUrl").val();return e&&(o.modal("hide"),p.handleImageCrop({url:e,socketMethod:"user.uploadCroppedPicture",aspectRatio:1,allowSkippingCrop:!1,paramName:"uid",paramValue:ajaxify.data.theirid},r)),!1})}),!1}),a.find('[data-action="remove-uploaded"]').on("click",function(){socket.emit("user.removeUploadedPicture",{uid:ajaxify.data.theirid}
1,function(o){if(a.modal("hide"),o)return d.error(o);s()})})}function l(a,r){return x.put(`/users/${ajaxify.data.theirid}/picture`,{type:a,bgColor:r})}return f}).apply(C,m),y!==void 0&&(D.exports=y)},49897:(D,C,c)=>{c.r(C),c.d(C,{del:()=>o,get:()=>t,head:()=>l,patch:()=>r,post:()=>a,put:()=>s});var m=c(91749),y=c.n(m),p=c(33530),x=c.n(p);const v=config.relative_path+"/api/v3";async function d(e,i){if(e.url=e.url.startsWith("/api")?config.relative_path+e.url:v+e.url,typeof i=="function"){f(e).then(n=>i(null,n),n=>i(n));return}try{return await f(e)}catch(n){if(n.message==="A valid login session was not found. Please log in and try again."){const{url:g}=await(0,m.fire)("filter:admin.reauth",{url:"login"});return(0,p.confirm)("[[error:api.reauth-required]]",u=>{u&&ajaxify.go(g)})}throw n}}async function f(e){const{url:i}=e;delete e.url,e.data&&!(e.data instanceof FormData)&&(e.data=JSON.stringify(e.data||{}),e.headers["content-type"]="application/json; charset=utf-8"),{options:e}=await(0,m.fire)("filter:api.options",{options:e}),e.data&&(e.body=e.data,delete e.data);const n=await fetch(i,e),{headers:g}=n;if(g.get("x-redirect"))return f({url:g.get("x-redirect"),...e});const u=g.get("content-type"),b=u&&u.startsWith("application/json");let h;if(e.method!=="HEAD"&&(b?h=await n.json():h=await n.text()),!n.ok)throw h?new Error(b?h.status.message:h):new Error(n.statusText);return b&&h&&h.hasOwnProperty("status")&&h.hasOwnProperty("response")?h.response:h}function t(e,i,n){return d({url:e+(i&&Object.keys(i).length?"?"+$.param(i):"")},n)}function l(e,i,n){return d({url:e+(i&&Object.keys(i).length?"?"+$.param(i):""),method:"HEAD"},n)}function a(e,i,n){return d({url:e,method:"POST",data:i,headers:{"x-csrf-token":config.csrf_token}},n)}function r(e,i,n){return d({url:e,method:"PATCH",data:i,headers:{"x-csrf-token":config.csrf_token}},n)}function s(e,i,n){return d({url:e,method:"PUT",data:i,headers:{"x-csrf-token":config.csrf_token}},n)}function o(e,i,n){return d({url:e,method:"DELETE",data:i,headers:{"x-csrf-token":config.csrf_token}},n)}},72254:(D,C,c)=>{var m,y;m=[c(29930)],y=function(p){const x={};x.show=function(t,l){const a=t.hasOwnProperty("fileSize")&&t.fileSize!==void 0?parseInt(t.fileSize,10):!1;app.parseAndTranslate("modals/upload-file",{showHelp:t.hasOwnProperty("showHelp")&&t.showHelp!==void 0?t.showHelp:!0,fileSize:a,title:t.title||"[[global:upload-file]]",description:t.description||"",button:t.button||"[[global:upload]]",accept:t.accept?t.accept.replace(/,/g,"&#44; "):""},function(r){r.modal("show"),r.on("hidden.bs.modal",function(){r.remove()});const s=r.find("#uploadForm");t.route&&s.attr("action",t.route),r.find("#fileUploadSubmitBtn").on("click",function(){return $(this).addClass("disabled"),t.uploadModal=r,f(t,l),!1})})},x.handleImageCrop=function(t,l){$("#crop-picture-modal").remove(),app.parseAndTranslate("modals/crop_picture",{url:utils.escapeHTML(t.url)},async function(a){a.modal({backdrop:"static"}).modal("show");const r=parseInt($(window).height()/2,10),s=document.getElementById("cropped-image");$(s).css("max-height",r);const o=(await c.e(60239).then(c.t.bind(c,65643,23))).default;let e=new o(s,{aspectRatio:t.aspectRatio,autoCropArea:1,viewMode:1,checkCrossOrigin:!0,cropmove:function(){t.restrictImageDimension&&(e.cropBoxData.width>t.imageDimension&&e.setCropBoxData({width:t.imageDimension}),e.cropBoxData.height>t.imageDimension&&e.setCropBoxData({height:t.imageDimension}))},ready:function(){if(!d(e,t))return a.modal("hide");if(t.restrictImageDimension){const i=s.width<s.height?s.width:s.height,n=i>t.imageDimension?t.imageDimension:i;e.setCropBoxData({width:n,height:n})}a.find(".rotate").on("click",function(){const i=this.getAttribute("data-degrees");e.rotate(i)}),a.find(".flip").on("click",function(){const i=this.getAttribute("data-option");this.getAttribute("data-method")==="scaleX"?e.scaleX(i):e.scaleY(i),this.setAttribute("data-option",i*-1)}),a.find(".reset").on("click",function(){e.reset()}),a.find(".crop-btn").on("click",function(){$(this).addClass("disabled");const i=d(e,t);i&&(a.find("#upload-progress-bar").css("width","0%"),a.find("#upload-progress-box").show().removeClass("hide"),v({data:t,imageData:i,progressBarEl:a.find("#upload-progress-bar")},function(n,g){if(n)return a.find("#upload-progress-box").hide(),a.find(".upload-btn").removeClass("disabled"),a.find(".crop-btn").removeClass("disabled"),p.error(n);l(g.url),a.modal("hide")}))}),a.find(".upload-btn").on("click",async function(){$(this).addClass("disabled"),e.destroy();const i=(await c.e(60239).then(c.t.bind(c,65643,23))).default;e=new i(s,{viewMode:1,autoCropArea:1,ready:function(){a.find(".crop-btn").trigger("click")}})})}})})};function v(t,l){const a={};a[t.data.paramName]=t.data.paramValue,a.method=t.data.socketMethod,a.size=t.imageData.length,a.progress=0;const r=1e5;function s(){const o=t.imageData.slice(a.progress,a.progress+r);socket.emit("uploads.upload",{chunk:o,params:a},function(e,i){if(e)return p.error(e);
1if(a.progress+r<a.size)return a.progress+=o.length,t.progressBarEl.css("width",(a.progress/a.size*100).toFixed(2)+"%"),setTimeout(s,100);t.progressBarEl.css("width","100%"),l(null,i)})}s()}function d(t,l){let a;try{a=l.imageType?t.getCroppedCanvas().toDataURL(l.imageType):t.getCroppedCanvas().toDataURL()}catch(r){["The operation is insecure.","Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported."].indexOf(r.message)!==-1?p.error("[[error:cors-error]]"):p.error(r.message);return}return a}function f(t,l){function a(i,n){i==="error"&&t.uploadModal.find("#fileUploadSubmitBtn").removeClass("disabled"),t.uploadModal.find("#alert-"+i).translateText(n).removeClass("hide")}const r=t.uploadModal.find("#fileInput");if(!r.val())return a("error","[[uploads:select-file-to-upload]]");const s=r[0].files[0],o=t.hasOwnProperty("fileSize")&&t.fileSize!==void 0?parseInt(t.fileSize,10):!1;if(o&&s.size>o*1024)return a("error","[[error:file-too-big, "+o+"]]");if(s.name.endsWith(".gif")){c.e(98463).then(function(){var i=[c(24187)];(function(n){n.ajaxSubmit(t.uploadModal,l)}).apply(null,i)}).catch(c.oe);return}const e=new FileReader;e.addEventListener("load",function(){const i=e.result;t.uploadModal.modal("hide"),x.handleImageCrop({url:i,imageType:s.type,socketMethod:t.socketMethod,aspectRatio:t.aspectRatio,allowSkippingCrop:t.allowSkippingCrop,restrictImageDimension:t.restrictImageDimension,imageDimension:t.imageDimension,paramName:t.paramName,paramValue:t.paramValue},l)},!1),s&&e.readAsDataURL(s)}return x}.apply(C,m),y!==void 0&&(D.exports=y)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.