diff --git a/js/dist/forum.js b/js/dist/forum.js index 50b31ae..dbe4768 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var o={};function a(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=t,a.c=o,a.d=function(t,o,n){a.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,o){if(1&o&&(t=a(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var i in t)a.d(n,i,function(o){return t[o]}.bind(null,i));return n},a.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(o,"a",o),o},a.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},a.p="",a(a.s=16)}([function(t,o){t.exports=flarum.core.compat["forum/app"]},function(t,o){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,o){t.exports=flarum.core.compat["common/utils/classList"]},,function(t,o){t.exports=flarum.core.compat["common/utils/ItemList"]},function(t,o){t.exports=flarum.core.compat["common/Model"]},function(t,o){t.exports=flarum.core.compat["common/models/User"]},function(t,o){t.exports=flarum.core.compat["common/components/Badge"]},function(t,o){t.exports=flarum.core.compat["common/helpers/icon"]},function(t,o){t.exports=flarum.core.compat["common/extend"]},function(t,o){t.exports=flarum.core.compat["forum/components/UserCard"]},function(t,o){t.exports=flarum.core.compat["common/components/Modal"]},function(t,o){t.exports=flarum.core.compat["common/components/Button"]},function(t,o){t.exports=flarum.core.compat["common/Component"]},function(t,o){t.exports=flarum.core.compat["common/utils/withAttr"]},function(t,o){t.exports=flarum.core.compat["common/components/Dropdown"]},function(t,o,a){"use strict";a.r(o);var n=a(0),i=a.n(n),e=a(5),r=a.n(e),s=a(6),c=a.n(s),f=a(9),l=a(10),u=a.n(l),b=a(7),p=a.n(b),d=a(4),h=a.n(d),v=a(2),g=a.n(v);function y(t,o){return(y=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t})(t,o)}function x(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,y(t,o)}var w=a(11),k=a.n(w),S=a(12),B=a.n(S),N=a(1),j=a.n(N),C=a(13),E=a.n(C),F=a(14),_=a.n(F);var O=a(15),P=a.n(O),M=a(8),U=a.n(M),I=function(t){function o(){return t.apply(this,arguments)||this}x(o,t),o.initAttrs=function(o){t.initAttrs.call(this,o),o.className="icondropdown",o.buttonClassName="Button Button--icon",o.menuClassName="social-dropdown-menu"};var a=o.prototype;return a.oninit=function(o){t.prototype.oninit.call(this,o),this.icons={social:["fas fa-envelope","fas fa-globe","fab fa-amazon","fab fa-angellist","fab fa-apple","fab fa-behance","fab fa-bitbucket","fab fa-codepen","fab fa-connectdevelop","fab fa-dashcube","fab fa-delicious","fab fa-deviantart","fab fa-digg","fab fa-discord","fab fa-dribbble","fab fa-dropbox","fab fa-drupal","fab fa-facebook","fab fa-flickr","fab fa-foursquare","fab fa-get-pocket","fab fa-git","fab fa-github","fab fa-github-alt","fab fa-google","fab fa-google-plus","fab fa-google-wallet","fab fa-hacker-news","fab fa-instagram","fab fa-ioxhost","fab fa-joomla","fab fa-jsfiddle","fab fa-lastfm","fab fa-leanpub","fab fa-linkedin","fab fa-mastodon","fab fa-medium","fab fa-odnoklassniki","fab fa-opencart","fab fa-pagelines","fab fa-paypal","fab fa-pied-piper-alt","fab fa-pinterest-p","fab fa-playstation","fab fa-qq","fab fa-reddit","fab fa-renren","fab fa-sellsy","fas fa-share-alt","fab fa-shirtsinbulk","fab fa-simplybuilt","fab fa-skyatlas","fab fa-skype","fab fa-slack","fab fa-slideshare","fab fa-soundcloud","fab fa-spotify","fab fa-stack-exchange","fab fa-stack-overflow","fab fa-steam","fab fa-stumbleupon","fab fa-telegram","fab fa-tencent-weibo","fab fa-trello","fab fa-tripadvisor","fab fa-tumblr","fab fa-twitch","fab fa-twitter","fab fa-viacoin","fab fa-vimeo","fab fa-vine","fab fa-vk","fab fa-weibo","fab fa-weixin","fab fa-whatsapp","fab fa-wordpress","fab fa-xbox","fab fa-xing","fab fa-y-combinator","fab fa-yandex","fab fa-yandex-international","fab fa-yelp","fab fa-youtube"]}},a.view=function(o){return o.children=this.items().toArray(),t.prototype.view.call(this,o)},a.getButtonContent=function(){var t=this,o=function(t){return U()(t,{className:"icondropdown-activeIcon fa-fw"})};return[/^favicon(-\w+)?$/.test(this.attrs.selection())?this.attrs.allowsExternal?[m("img",{className:g()({"icondropdown-activeIcon":!0,"social-greyscale-button":"favicon-grey"===this.attrs.selection(),"social-button":"favicon-grey"===!this.attrs.selection()}),alt:"",src:this.attrs.favicon(),onerror:function(){t.attrs.favicon("none"),t.select(t.icons.social[0])}})]:o("fas fa-globe"):o(this.attrs.selection()),this.attrs.caretIcon?U()(this.attrs.caretIcon,{className:"Button-caret"}):""]},a.items=function(){var t=this,o=new h.a;return"none"!==this.attrs.favicon()&&this.attrs.allowsExternal&&(o.add("favicon",m("div",{onclick:function(){return t.select("favicon")},role:"button",className:g()({"iconpicker-item":!0,"iconpicker-item--highlighted":"favicon"===this.attrs.selection()}),title:"Favicon"},m("img",{className:"iconpicker-image-"+this.attrs.index(),alt:"favicon",style:{width:"14px",height:"14px",margin:"0 2px 0 2px"},src:this.attrs.favicon()})),102),o.add("favicon-grey",m("div",{onclick:function(){return t.select("favicon-grey")},role:"button",className:g()({"iconpicker-item iconpicker-item--invertColors":!0,"iconpicker-item--highlighted":"favicon-grey"===this.attrs.selection()}),title:"Grey Favicon"},m("img",{className:"social-greyscale-button iconpicker-image-"+this.attrs.index(),alt:"favicon",style:{width:"14px",height:"14px",margin:"0 2px 0 2px"},src:this.attrs.favicon()})),101)),this.icons.social.forEach((function(a){o.add(a.replace(/ /,"-"),m("div",{onclick:function(){return t.select(a)},className:g()({"iconpicker-item":!0,"iconpicker-item--highlighted":t.attrs.selection()===a}),role:"button",title:"."+a},U()(a,{className:"social-icon fa-fw"})),100)})),o},a.select=function(t){this.attrs.selection(t)},o}(P.a),A=function(t){function o(){return t.apply(this,arguments)||this}x(o,t);var a=o.prototype;return a.oninit=function(o){t.prototype.oninit.call(this,o),this.button=this.attrs.button,this.allowsExternal=i.a.forum.attribute("fof-socialprofile.allow_external_favicons")},a.view=function(t){return m("div",{className:"Form-group form-group-social",id:"socialgroup-"+this.button.index()},m("input",{type:"text",className:"FormControl SocialFormControl SocialFormControl-title",placeholder:i.a.translator.trans("fof-socialprofile.forum.edit.title"),tabIndex:2*(this.button.index()+1)-1,bidi:this.button.title}),I.component({selection:this.button.icon,favicon:this.button.favicon,index:this.button.index,allowsExternal:this.allowsExternal}),m("input",{type:"text",className:"FormControl SocialFormControl SocialFormControl-url",placeholder:i.a.translator.trans("fof-socialprofile.forum.edit.url"),tabIndex:2*(this.button.index()+1),value:this.button.url(),onchange:_()("value",this.onUrlChange.bind(this))}),m("input",{type:"hidden",className:"FormControl SocialFormControl SocialFormControl-icon",id:"icon"+this.button.index()+"-icon",bidi:this.button.icon}),m("input",{type:"hidden",className:"SocialFormControl SocialFormControl-favicon",id:"icon"+this.button.index()+"-favicon",bidi:this.button.favicon}))},a.onUrlChange=function(t){var o=this;this.button.url(t),this.allowsExternal&&(clearTimeout(this.waitUntilFinished),"fas fa-circle-notch fa-spin"!==this.button.icon()&&(this.button.icon("fas fa-circle-notch fa-spin"),this.button.favicon("none")),this.waitUntilFinished=setTimeout((function(){if(function(t){var o;try{o=new URL(t)}catch(t){return!1}return["http:","https:"].includes(o.protocol)}(o.button.url())){var t=function(t){var o;try{o=new URL(t)}catch(t){return null}return["http:","https:"].includes(o.protocol)?o.origin:null}(o.button.url())+"/favicon.ico";o.button.favicon(t),o.button.icon("favicon"),m.redraw()}else o.button.icon("fas fa-globe"),o.button.favicon("none"),m.redraw()}),1e3))},o}(E.a),L=function(t){function o(){return t.apply(this,arguments)||this}x(o,t);var a=o.prototype;return a.oninit=function(o){var a=this;t.prototype.oninit.call(this,o),this.buttons=[];var n=this.attrs.user.socialButtons();n.length?n.forEach((function(t,o){""!==t.title&&a.createButtonObject(o,t)})):this.createButtonObject(0)},a.className=function(){return"SocialButtonsModal Modal--small"},a.title=function(){return app.translator.trans("fof-socialprofile.forum.edit.headtitle")},a.content=function(){var t=this.buttons.some((function(t){return"fas fa-circle-notch fa-spin"===t.icon()}));return m("div",{className:"Modal-body"},m("div",{className:"Form"},this.buttons.map((function(t){return A.component({button:t})})),m("div",{className:"Form-group",id:"submit-button-group"},m("div",{className:"Button Button--primary EditSocialButtons-add",style:"margin-left: 1%;",onclick:this.addSocialButton.bind(this)},m("i",{className:"fas fa-fw fa-plus"})),m("div",{className:"Button Button--primary EditSocialButtons-del",style:"margin-left: 1%;",onclick:this.delSocialButton.bind(this)},m("i",{className:"fas fa-fw fa-minus"})),B.a.component({type:"submit",style:"float: right;",className:"Button Button--primary EditSocialButtons-save",loading:this.loading,disabled:t,title:t?app.translator.trans("fof-socialprofile.forum.edit.save_disabled_fetching_favicons"):null},app.translator.trans("fof-socialprofile.forum.edit.submit")))))},a.data=function(){var t=[];return this.buttons.forEach((function(o,a){""!==o.title()&&(t[a]={},t[a].title=o.title(),t[a].url=o.url(),t[a].icon=o.icon(),t[a].favicon=o.favicon())})),{socialButtons:JSON.stringify(t)}},a.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).then($("#app").trigger("refreshSocialButtons",[this.data().socialButtons])).catch((function(){o.loading=!1,m.redraw()}))},a.addSocialButton=function(){var t=this;this.createButtonObject(this.buttons.length),m.redraw(),$("document").ready((function(){$("#socialgroup-"+(t.buttons.length-1)).slideDown()}))},a.delSocialButton=function(){var t=this,o=this.buttons.length-1;$("#socialgroup-"+o).slideUp("normal",(function(){t.buttons.splice(o,1),m.redraw()}))},a.createButtonObject=function(t,o){void 0===o&&(o=null),null==o?(this.buttons[t]={},this.buttons[t].index=j()(t),this.buttons[t].favicon=j()("none"),this.buttons[t].title=j()(""),this.buttons[t].url=j()(""),this.buttons[t].icon=j()("fas fa-globe")):(this.buttons[t]={},this.buttons[t].index=j()(t),this.buttons[t].favicon=j()(o.favicon),this.buttons[t].title=j()(o.title),this.buttons[t].url=j()(o.url),this.buttons[t].icon=j()(o.icon))},o}(k.a);i.a.initializers.add("fof/socialprofile",(function(){c.a.prototype.socialButtons=r.a.attribute("socialButtons",(function(t){return JSON.parse(t||"[]")})),c.a.prototype.canViewSocialProfile=r.a.attribute("canViewSocialProfile"),c.a.prototype.canEditSocialProfile=r.a.attribute("canEditSocialProfile"),Object(f.extend)(u.a.prototype,"infoItems",(function(t){var o=this,a=this.attrs.user;if(a.canViewSocialProfile()){this.canEdit=a.canEditSocialProfile(),this.buttons=this.attrs.user.socialButtons();var n=new h.a;this.buttons.length?(this.buttons.forEach((function(t,a){if(""!==t.title&&""!==t.icon&&""!==t.url){var e,r,s="",c=g()(((e={})["social-button "+t.icon+"-"+a+" social-icon-"+a]=!0,e["social-greyscale-button"]="favicon-grey"===t.icon,e));"favicon"!==t.icon&&"favicon-grey"!==t.icon||(i.a.forum.attribute("fof-socialprofile.allow_external_favicons")?s='\n background-image: url("'+t.favicon+'");\n background-size: 60%;\n background-position: center;\n background-repeat: no-repeat;\n ':c+=" fas fa-globe"),n.add("social-icon-"+a,m("a",{href:t.url,target:"_blank",rel:"noreferrer noopener nofollow"},p.a.component({className:g()((r={},r[c]=!0,r["social-icon--deleting"]=o.deleting,r)),type:"social",icon:t.icon,label:t.title,style:s})))}})),this.canEdit&&n.add("settings social-button",p.a.component({type:"social social-settings",icon:"fas fa-cog",label:i.a.translator.trans("fof-socialprofile.forum.edit.edit"),onclick:function(){i.a.modal.show(L,{user:o.attrs.user})}}),-1)):this.canEdit&&n.add("settings social-button",p.a.component({type:"social null-social-settings",icon:"fas fa-plus",label:i.a.translator.trans("fof-socialprofile.forum.edit.add"),onclick:function(){i.a.modal.show(L,{user:o.attrs.user})}}),-1),n.toArray().length>0&&(t.has("lastSeen")&&t.replace("lastSeen",t.lastSeen,50),t.has("joined")&&t.replace("joined",t.joined,40),t.add("fofsocialprofile",n.toArray(),20))}}))}))}]); +module.exports=function(t){var o={};function a(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=t,a.c=o,a.d=function(t,o,n){a.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,o){if(1&o&&(t=a(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var i in t)a.d(n,i,function(o){return t[o]}.bind(null,i));return n},a.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(o,"a",o),o},a.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},a.p="",a(a.s=16)}([function(t,o){t.exports=flarum.core.compat["forum/app"]},function(t,o){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,o){t.exports=flarum.core.compat["common/utils/classList"]},,function(t,o){t.exports=flarum.core.compat["common/utils/ItemList"]},function(t,o){t.exports=flarum.core.compat["common/Model"]},function(t,o){t.exports=flarum.core.compat["common/models/User"]},function(t,o){t.exports=flarum.core.compat["common/components/Badge"]},function(t,o){t.exports=flarum.core.compat["common/helpers/icon"]},function(t,o){t.exports=flarum.core.compat["common/extend"]},function(t,o){t.exports=flarum.core.compat["forum/components/UserCard"]},function(t,o){t.exports=flarum.core.compat["common/components/Modal"]},function(t,o){t.exports=flarum.core.compat["common/components/Button"]},function(t,o){t.exports=flarum.core.compat["common/Component"]},function(t,o){t.exports=flarum.core.compat["common/utils/withAttr"]},function(t,o){t.exports=flarum.core.compat["common/components/Dropdown"]},function(t,o,a){"use strict";a.r(o);var n=a(0),i=a.n(n),e=a(5),r=a.n(e),s=a(6),c=a.n(s),f=a(9),l=a(10),u=a.n(l),b=a(7),p=a.n(b),d=a(4),h=a.n(d),v=a(2),g=a.n(v);function y(t,o){return(y=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t})(t,o)}function x(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,y(t,o)}var w=a(11),k=a.n(w),S=a(12),B=a.n(S),N=a(1),j=a.n(N),C=a(13),E=a.n(C),F=a(14),O=a.n(F);var _=a(15),P=a.n(_),M=a(8),U=a.n(M),I=function(t){function o(){return t.apply(this,arguments)||this}x(o,t),o.initAttrs=function(o){t.initAttrs.call(this,o),o.className="icondropdown",o.buttonClassName="Button Button--icon",o.menuClassName="social-dropdown-menu"};var a=o.prototype;return a.oninit=function(o){t.prototype.oninit.call(this,o),this.icons={social:["fas fa-envelope","fas fa-globe","fab fa-amazon","fab fa-angellist","fab fa-apple","fab fa-behance","fab fa-bitbucket","fab fa-codepen","fab fa-connectdevelop","fab fa-dashcube","fab fa-delicious","fab fa-deviantart","fab fa-digg","fab fa-discord","fab fa-dribbble","fab fa-dropbox","fab fa-drupal","fab fa-facebook","fab fa-flickr","fab fa-foursquare","fab fa-get-pocket","fab fa-git","fab fa-github","fab fa-github-alt","fab fa-google","fab fa-google-plus","fab fa-google-wallet","fab fa-hacker-news","fab fa-instagram","fab fa-ioxhost","fab fa-joomla","fab fa-jsfiddle","fab fa-lastfm","fab fa-leanpub","fab fa-linkedin","fab fa-mastodon","fab fa-medium","fab fa-odnoklassniki","fab fa-opencart","fab fa-pagelines","fab fa-paypal","fab fa-pied-piper-alt","fab fa-pinterest-p","fab fa-playstation","fab fa-qq","fab fa-reddit","fab fa-renren","fab fa-sellsy","fas fa-share-alt","fab fa-shirtsinbulk","fab fa-simplybuilt","fab fa-skyatlas","fab fa-skype","fab fa-slack","fab fa-slideshare","fab fa-soundcloud","fab fa-spotify","fab fa-stack-exchange","fab fa-stack-overflow","fab fa-steam","fab fa-stumbleupon","fab fa-telegram","fab fa-tencent-weibo","fab fa-trello","fab fa-tripadvisor","fab fa-tumblr","fab fa-twitch","fab fa-twitter","fab fa-viacoin","fab fa-vimeo","fab fa-vine","fab fa-vk","fab fa-weibo","fab fa-weixin","fab fa-whatsapp","fab fa-wordpress","fab fa-xbox","fab fa-xing","fab fa-y-combinator","fab fa-yandex","fab fa-yandex-international","fab fa-yelp","fab fa-youtube"]}},a.view=function(o){return o.children=this.items().toArray(),t.prototype.view.call(this,o)},a.getButtonContent=function(){var t=this,o=function(t){return U()(t,{className:"icondropdown-activeIcon fa-fw"})};return[/^favicon(-\w+)?$/.test(this.attrs.selection())?this.attrs.allowsExternal?[m("img",{className:g()({"icondropdown-activeIcon":!0,"social-greyscale-button":"favicon-grey"===this.attrs.selection(),"social-button":"favicon-grey"===!this.attrs.selection()}),alt:"",src:this.attrs.favicon(),onerror:function(){t.attrs.favicon("none"),t.select(t.icons.social[0])}})]:o("fas fa-globe"):o(this.attrs.selection()),this.attrs.caretIcon?U()(this.attrs.caretIcon,{className:"Button-caret"}):""]},a.items=function(){var t=this,o=new h.a;return"none"!==this.attrs.favicon()&&this.attrs.allowsExternal&&(o.add("favicon",m("div",{onclick:function(){return t.select("favicon")},role:"button",className:g()({"iconpicker-item":!0,"iconpicker-item--highlighted":"favicon"===this.attrs.selection()}),title:"Favicon"},m("img",{className:"iconpicker-image-"+this.attrs.index(),alt:"favicon",style:{width:"14px",height:"14px",margin:"0 2px 0 2px"},src:this.attrs.favicon()})),102),o.add("favicon-grey",m("div",{onclick:function(){return t.select("favicon-grey")},role:"button",className:g()({"iconpicker-item iconpicker-item--invertColors":!0,"iconpicker-item--highlighted":"favicon-grey"===this.attrs.selection()}),title:"Grey Favicon"},m("img",{className:"social-greyscale-button iconpicker-image-"+this.attrs.index(),alt:"favicon",style:{width:"14px",height:"14px",margin:"0 2px 0 2px"},src:this.attrs.favicon()})),101)),this.icons.social.forEach((function(a){o.add(a.replace(/ /,"-"),m("div",{onclick:function(){return t.select(a)},className:g()({"iconpicker-item":!0,"iconpicker-item--highlighted":t.attrs.selection()===a}),role:"button",title:"."+a},U()(a,{className:"social-icon fa-fw"})),100)})),o},a.select=function(t){this.attrs.selection(t)},o}(P.a),A=function(t){function o(){return t.apply(this,arguments)||this}x(o,t);var a=o.prototype;return a.oninit=function(o){t.prototype.oninit.call(this,o),this.button=this.attrs.button,this.allowsExternal=i.a.forum.attribute("fof-socialprofile.allow_external_favicons")},a.view=function(t){return m("div",{className:"Form-group form-group-social",id:"socialgroup-"+this.button.index()},m("input",{type:"text",className:"FormControl SocialFormControl SocialFormControl-title",placeholder:i.a.translator.trans("fof-socialprofile.forum.edit.title"),tabIndex:2*(this.button.index()+1)-1,bidi:this.button.title}),I.component({selection:this.button.icon,favicon:this.button.favicon,index:this.button.index,allowsExternal:this.allowsExternal}),m("input",{type:"text",className:"FormControl SocialFormControl SocialFormControl-url",placeholder:i.a.translator.trans("fof-socialprofile.forum.edit.url"),tabIndex:2*(this.button.index()+1),value:this.button.url(),onchange:O()("value",this.onUrlChange.bind(this))}),m("input",{type:"hidden",className:"FormControl SocialFormControl SocialFormControl-icon",id:"icon"+this.button.index()+"-icon",bidi:this.button.icon}),m("input",{type:"hidden",className:"SocialFormControl SocialFormControl-favicon",id:"icon"+this.button.index()+"-favicon",bidi:this.button.favicon}))},a.onUrlChange=function(t){var o=this;this.button.url(t),this.allowsExternal&&(clearTimeout(this.waitUntilFinished),"fas fa-circle-notch fa-spin"!==this.button.icon()&&(this.button.icon("fas fa-circle-notch fa-spin"),this.button.favicon("none")),this.waitUntilFinished=setTimeout((function(){if(function(t){var o;try{o=new URL(t)}catch(t){return!1}return["http:","https:"].includes(o.protocol)}(o.button.url())){var t=function(t){var o;try{o=new URL(t)}catch(t){return null}return["http:","https:"].includes(o.protocol)?o.origin:null}(o.button.url())+"/favicon.ico";o.button.favicon(t),o.button.icon("favicon"),m.redraw()}else o.button.icon("fas fa-globe"),o.button.favicon("none"),m.redraw()}),1e3))},o}(E.a),L=function(t){function o(){return t.apply(this,arguments)||this}x(o,t);var a=o.prototype;return a.oninit=function(o){var a=this;t.prototype.oninit.call(this,o),this.buttons=[];var n=this.attrs.user.socialButtons();n.length?n.forEach((function(t,o){t&&t.title&&a.createButtonObject(o,t)})):this.createButtonObject(0)},a.className=function(){return"SocialButtonsModal Modal--small"},a.title=function(){return app.translator.trans("fof-socialprofile.forum.edit.headtitle")},a.content=function(){var t=this.buttons.some((function(t){return"fas fa-circle-notch fa-spin"===t.icon()}));return m("div",{className:"Modal-body"},m("div",{className:"Form"},this.buttons.map((function(t){return A.component({button:t})})),m("div",{className:"Form-group",id:"submit-button-group"},m("div",{className:"Button Button--primary EditSocialButtons-add",style:"margin-left: 1%;",onclick:this.addSocialButton.bind(this)},m("i",{className:"fas fa-fw fa-plus"})),m("div",{className:"Button Button--primary EditSocialButtons-del",style:"margin-left: 1%;",onclick:this.delSocialButton.bind(this)},m("i",{className:"fas fa-fw fa-minus"})),B.a.component({type:"submit",style:"float: right;",className:"Button Button--primary EditSocialButtons-save",loading:this.loading,disabled:t,title:t?app.translator.trans("fof-socialprofile.forum.edit.save_disabled_fetching_favicons"):null},app.translator.trans("fof-socialprofile.forum.edit.submit")))))},a.data=function(){var t=[];return this.buttons.forEach((function(o){o&&o.title()&&o.url()&&t.push({title:o.title(),url:o.url(),icon:o.icon(),favicon:o.favicon()})})),console.log(JSON.stringify(t)),{socialButtons:JSON.stringify(t)}},a.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).then($("#app").trigger("refreshSocialButtons",[this.data().socialButtons])).catch((function(){o.loading=!1,m.redraw()}))},a.addSocialButton=function(){var t=this;this.createButtonObject(this.buttons.length),m.redraw(),$("document").ready((function(){$("#socialgroup-"+(t.buttons.length-1)).slideDown()}))},a.delSocialButton=function(){var t=this,o=this.buttons.length-1;$("#socialgroup-"+o).slideUp("normal",(function(){t.buttons.splice(o,1),m.redraw()}))},a.createButtonObject=function(t,o){void 0===o&&(o=null),null==o?(this.buttons[t]={},this.buttons[t].index=j()(t),this.buttons[t].favicon=j()("none"),this.buttons[t].title=j()(""),this.buttons[t].url=j()(""),this.buttons[t].icon=j()("fas fa-globe")):(this.buttons[t]={},this.buttons[t].index=j()(t),this.buttons[t].favicon=j()(o.favicon),this.buttons[t].title=j()(o.title),this.buttons[t].url=j()(o.url),this.buttons[t].icon=j()(o.icon))},o}(k.a);i.a.initializers.add("fof/socialprofile",(function(){c.a.prototype.socialButtons=r.a.attribute("socialButtons",(function(t){return JSON.parse(t||"[]")})),c.a.prototype.canViewSocialProfile=r.a.attribute("canViewSocialProfile"),c.a.prototype.canEditSocialProfile=r.a.attribute("canEditSocialProfile"),Object(f.extend)(u.a.prototype,"infoItems",(function(t){var o=this,a=this.attrs.user;if(a.canViewSocialProfile()){this.canEdit=a.canEditSocialProfile(),this.buttons=this.attrs.user.socialButtons();var n=new h.a;this.buttons.length?(this.buttons.forEach((function(t,a){if(t&&t.title&&t.icon&&t.url){var e,r,s="",c=g()(((e={})["social-button "+t.icon+"-"+a+" social-icon-"+a]=!0,e["social-greyscale-button"]="favicon-grey"===t.icon,e));"favicon"!==t.icon&&"favicon-grey"!==t.icon||(i.a.forum.attribute("fof-socialprofile.allow_external_favicons")?s='\n background-image: url("'+t.favicon+'");\n background-size: 60%;\n background-position: center;\n background-repeat: no-repeat;\n ':c+=" fas fa-globe"),n.add("social-icon-"+a,m("a",{href:t.url,target:"_blank",rel:"noreferrer noopener nofollow"},p.a.component({className:g()((r={},r[c]=!0,r["social-icon--deleting"]=o.deleting,r)),type:"social",icon:t.icon,label:t.title,style:s})))}})),this.canEdit&&n.add("settings social-button",p.a.component({type:"social social-settings",icon:"fas fa-cog",label:i.a.translator.trans("fof-socialprofile.forum.edit.edit"),onclick:function(){i.a.modal.show(L,{user:o.attrs.user})}}),-1)):this.canEdit&&n.add("settings social-button",p.a.component({type:"social null-social-settings",icon:"fas fa-plus",label:i.a.translator.trans("fof-socialprofile.forum.edit.add"),onclick:function(){i.a.modal.show(L,{user:o.attrs.user})}}),-1),n.toArray().length>0&&(t.has("lastSeen")&&t.replace("lastSeen",t.lastSeen,50),t.has("joined")&&t.replace("joined",t.joined,40),t.add("fofsocialprofile",n.toArray(),20))}}))}))}]); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 4a072bb..12eb477 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/socialprofile/webpack/bootstrap","webpack://@fof/socialprofile/external \"flarum.core.compat['forum/app']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/Model']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/models/User']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/helpers/icon']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/extend']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['forum/components/UserCard']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/Component']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/withAttr']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Dropdown']\"","webpack://@fof/socialprofile/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/socialprofile/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/socialprofile/./src/forum/components/IconSelectorComponent.js","webpack://@fof/socialprofile/./src/forum/components/WebsiteInputComponent.js","webpack://@fof/socialprofile/./src/forum/helpers/isValidUrl.js","webpack://@fof/socialprofile/./src/forum/helpers/extractBaseUrl.js","webpack://@fof/socialprofile/./src/forum/components/SocialButtonsModal.js","webpack://@fof/socialprofile/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","IconSelectorComponent","initAttrs","attrs","className","buttonClassName","menuClassName","oninit","vnode","this","icons","social","view","children","items","toArray","getButtonContent","ic","str","icon","test","selection","allowsExternal","classList","alt","src","favicon","onerror","select","caretIcon","ItemList","add","onclick","role","title","index","style","width","height","margin","forEach","curIcon","replace","Dropdown","WebsiteInputComponent","button","app","forum","attribute","id","type","placeholder","translator","trans","tabIndex","bidi","component","url","onchange","withAttr","onUrlChange","clearTimeout","waitUntilFinished","setTimeout","urlInstance","URL","_","includes","protocol","isValidUrl","iconurl","origin","extractBaseUrl","redraw","Component","SocialButtonsModal","buttons","user","socialButtons","length","createButtonObject","content","areAnyIconsBeingFetched","some","map","addSocialButton","delSocialButton","Button","loading","disabled","data","JSON","stringify","onsubmit","e","preventDefault","save","errorHandler","then","hide","$","trigger","ready","slideDown","curdel","slideUp","splice","Stream","Modal","initializers","User","Model","parse","canViewSocialProfile","canEditSocialProfile","extend","UserCard","canEdit","buttonList","buttonStyle","href","target","rel","Badge","deleting","label","modal","show","has"],"mappings":"2BACE,IAAIA,EAAmB,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EAAc,GACdlH,EAAkBkB,MAAS,uBACTsB,EAAO1B,KADE,IACMgB,EADN,gBAC2BA,IAAU,EADrC,EAE3B,2BAA2C,iBAAhBU,EAAO1B,KAFP,IAKX,YAAhB0B,EAAO1B,MAAsC,iBAAhB0B,EAAO1B,OAChC2B,IAAIC,MAAMC,UAAU,6CACpBuE,EAAc,4DACe1E,EAAOnB,QADzB,wNAOXrB,GAAmB,iBAI3BiH,EAAWvF,IAAX,eACmBI,EACf,OAAGqF,KAAM3E,EAAOY,IAAKgE,OAAO,SAASC,IAAI,gCACpCC,IAAMnE,UAAU,CACbpD,UAAWmB,KAAS,OAAIlB,IAAkB,EAAtB,EAA4B,yBAAyB,EAAKuH,SAA1D,IACpB1E,KAAM,SACN/B,KAAM0B,EAAO1B,KACb0G,MAAOhF,EAAOX,MACdE,MAAOmF,UAOvB9G,KAAK4G,SACLC,EAAWvF,IACP,yBACA4F,IAAMnE,UAAU,CACZN,KAAM,yBACN/B,KAAM,aACN0G,MAAO/E,IAAIM,WAAWC,MAAM,qCAC5BrB,QAAS,WACLc,IAAIgF,MAAMC,KAAKpD,EAAoB,CAAEE,KAAM,EAAK1E,MAAM0E,WAG7D,IAGFpE,KAAK4G,SACZC,EAAWvF,IACP,yBACA4F,IAAMnE,UAAU,CACZN,KAAM,8BACN/B,KAAM,cACN0G,MAAO/E,IAAIM,WAAWC,MAAM,oCAC5BrB,QAAS,WACLc,IAAIgF,MAAMC,KAAKpD,EAAoB,CAAEE,KAAM,EAAK1E,MAAM0E,WAG7D,GAILyC,EAAWvG,UAAUgE,OAAS,IAC1BjE,EAAMkH,IAAI,aACVlH,EAAM4B,QAAQ,WAAY5B,EAAK,SAAc,IAE7CA,EAAMkH,IAAI,WACVlH,EAAM4B,QAAQ,SAAU5B,EAAK,OAAY,IAG7CA,EAAMiB,IAAI,mBAAoBuF,EAAWvG,UAAW","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 16);\n","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['common/utils/Stream'];","module.exports = flarum.core.compat['common/utils/classList'];","module.exports = flarum.core.compat['common/utils/ItemList'];","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['common/models/User'];","module.exports = flarum.core.compat['common/components/Badge'];","module.exports = flarum.core.compat['common/helpers/icon'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/components/UserCard'];","module.exports = flarum.core.compat['common/components/Modal'];","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/utils/withAttr'];","module.exports = flarum.core.compat['common/components/Dropdown'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import Dropdown from 'flarum/common/components/Dropdown';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport icon from 'flarum/common/helpers/icon';\nimport classList from 'flarum/common/utils/classList';\n\nexport default class IconSelectorComponent extends Dropdown {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n attrs.className = 'icondropdown';\n attrs.buttonClassName = 'Button Button--icon';\n attrs.menuClassName = 'social-dropdown-menu';\n }\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.icons = {\n social: [\n 'fas fa-envelope',\n 'fas fa-globe',\n 'fab fa-amazon',\n 'fab fa-angellist',\n 'fab fa-apple',\n 'fab fa-behance',\n 'fab fa-bitbucket',\n 'fab fa-codepen',\n 'fab fa-connectdevelop',\n 'fab fa-dashcube',\n 'fab fa-delicious',\n 'fab fa-deviantart',\n 'fab fa-digg',\n 'fab fa-discord',\n 'fab fa-dribbble',\n 'fab fa-dropbox',\n 'fab fa-drupal',\n 'fab fa-facebook',\n 'fab fa-flickr',\n 'fab fa-foursquare',\n 'fab fa-get-pocket',\n 'fab fa-git',\n 'fab fa-github',\n 'fab fa-github-alt',\n 'fab fa-google',\n 'fab fa-google-plus',\n 'fab fa-google-wallet',\n 'fab fa-hacker-news',\n 'fab fa-instagram',\n 'fab fa-ioxhost',\n 'fab fa-joomla',\n 'fab fa-jsfiddle',\n 'fab fa-lastfm',\n 'fab fa-leanpub',\n 'fab fa-linkedin',\n 'fab fa-mastodon',\n 'fab fa-medium',\n 'fab fa-odnoklassniki',\n 'fab fa-opencart',\n 'fab fa-pagelines',\n 'fab fa-paypal',\n 'fab fa-pied-piper-alt',\n 'fab fa-pinterest-p',\n 'fab fa-playstation',\n 'fab fa-qq',\n 'fab fa-reddit',\n 'fab fa-renren',\n 'fab fa-sellsy',\n 'fas fa-share-alt',\n 'fab fa-shirtsinbulk',\n 'fab fa-simplybuilt',\n 'fab fa-skyatlas',\n 'fab fa-skype',\n 'fab fa-slack',\n 'fab fa-slideshare',\n 'fab fa-soundcloud',\n 'fab fa-spotify',\n 'fab fa-stack-exchange',\n 'fab fa-stack-overflow',\n 'fab fa-steam',\n 'fab fa-stumbleupon',\n 'fab fa-telegram',\n 'fab fa-tencent-weibo',\n 'fab fa-trello',\n 'fab fa-tripadvisor',\n 'fab fa-tumblr',\n 'fab fa-twitch',\n 'fab fa-twitter',\n 'fab fa-viacoin',\n 'fab fa-vimeo',\n 'fab fa-vine',\n 'fab fa-vk',\n 'fab fa-weibo',\n 'fab fa-weixin',\n 'fab fa-whatsapp',\n 'fab fa-wordpress',\n 'fab fa-xbox',\n 'fab fa-xing',\n 'fab fa-y-combinator',\n 'fab fa-yandex',\n 'fab fa-yandex-international',\n 'fab fa-yelp',\n 'fab fa-youtube',\n ],\n };\n }\n\n view(vnode) {\n vnode.children = this.items().toArray();\n\n return super.view(vnode);\n }\n\n getButtonContent() {\n const ic = (str) => icon(str, { className: 'icondropdown-activeIcon fa-fw' });\n\n return [\n /^favicon(-\\w+)?$/.test(this.attrs.selection())\n ? this.attrs.allowsExternal\n ? [\n {\n this.attrs.favicon('none');\n this.select(this.icons.social[0]);\n }}\n />,\n ]\n : ic('fas fa-globe')\n : ic(this.attrs.selection()),\n this.attrs.caretIcon ? icon(this.attrs.caretIcon, { className: 'Button-caret' }) : '',\n ];\n }\n\n items() {\n const items = new ItemList();\n\n if (this.attrs.favicon() !== 'none' && this.attrs.allowsExternal) {\n items.add(\n 'favicon',\n this.select('favicon')}\n role=\"button\"\n className={classList({\n 'iconpicker-item': true,\n 'iconpicker-item--highlighted': this.attrs.selection() === 'favicon',\n })}\n title=\"Favicon\"\n >\n \n ,\n 102\n );\n\n items.add(\n 'favicon-grey',\n this.select('favicon-grey')}\n role=\"button\"\n className={classList({\n 'iconpicker-item iconpicker-item--invertColors': true,\n 'iconpicker-item--highlighted': this.attrs.selection() === 'favicon-grey',\n })}\n title=\"Grey Favicon\"\n >\n \n ,\n 101\n );\n }\n\n this.icons.social.forEach((curIcon) => {\n items.add(\n curIcon.replace(/ /, '-'),\n this.select(curIcon)}\n className={classList({ 'iconpicker-item': true, 'iconpicker-item--highlighted': this.attrs.selection() === curIcon })}\n role=\"button\"\n title={`.${curIcon}`}\n >\n {icon(curIcon, { className: 'social-icon fa-fw' })}\n ,\n 100\n );\n });\n\n return items;\n }\n\n select(icon) {\n this.attrs.selection(icon);\n }\n}\n","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport extractBaseUrl from '../helpers/extractBaseUrl';\nimport isValidUrl from '../helpers/isValidUrl';\nimport IconSelectorComponent from './IconSelectorComponent';\n\nexport default class WebsiteInputComponent extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.button = this.attrs.button;\n\n this.allowsExternal = app.forum.attribute('fof-socialprofile.allow_external_favicons');\n }\n\n view(vnode) {\n return (\n
\n \n\n {IconSelectorComponent.component({\n selection: this.button.icon,\n favicon: this.button.favicon,\n index: this.button.index,\n allowsExternal: this.allowsExternal,\n })}\n\n \n\n \n\n \n
\n );\n }\n\n onUrlChange(value) {\n this.button.url(value);\n\n if (!this.allowsExternal) {\n return;\n }\n\n clearTimeout(this.waitUntilFinished);\n\n if (this.button.icon() !== 'fas fa-circle-notch fa-spin') {\n this.button.icon('fas fa-circle-notch fa-spin');\n this.button.favicon('none');\n }\n\n this.waitUntilFinished = setTimeout(() => {\n if (isValidUrl(this.button.url())) {\n const iconurl = `${extractBaseUrl(this.button.url())}/favicon.ico`;\n\n this.button.favicon(iconurl);\n this.button.icon('favicon');\n\n m.redraw();\n } else {\n this.button.icon('fas fa-globe');\n this.button.favicon('none');\n m.redraw();\n }\n }, 1000);\n }\n}\n","/**\n * Verifies if a string is a valid URL (http/https only).\n *\n * @param {string} url URL to test\n */\nexport default function isValidUrl(url) {\n let urlInstance;\n\n try {\n urlInstance = new URL(url);\n } catch (_) {\n return false;\n }\n\n return ['http:', 'https:'].includes(urlInstance.protocol);\n}\n","/**\n * Extracts the base URL of a specified URL. Returns `null` if the URL is invalid.\n *\n * @example\n * // https://www.google.com\n * extractBaseUrl(\"https://www.google.com/search?q=flarum\")\n *\n * @example\n * // https://discuss.flarum.org\n * extractBaseUrl(\"https://discuss.flarum.org/u/admin\")\n *\n * @example\n * // null\n * extractBaseUrl(\"javascript:alert('hello!')\")\n *\n * @param {string|null} url URL to extract base from\n */\nexport default function extractBaseUrl(url) {\n let urlInstance;\n\n try {\n urlInstance = new URL(url);\n } catch (_) {\n return null;\n }\n\n if (['http:', 'https:'].includes(urlInstance.protocol)) {\n return urlInstance.origin;\n }\n\n return null;\n}\n","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\nimport WebsiteInputComponent from './WebsiteInputComponent';\n\nexport default class SocialButtonsModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.buttons = [];\n const buttons = this.attrs.user.socialButtons();\n\n if (buttons.length) {\n buttons.forEach((button, index) => {\n if (button.title !== '') {\n this.createButtonObject(index, button);\n }\n });\n } else {\n this.createButtonObject(0);\n }\n }\n\n className() {\n return 'SocialButtonsModal Modal--small';\n }\n\n title() {\n return app.translator.trans('fof-socialprofile.forum.edit.headtitle');\n }\n\n content() {\n const areAnyIconsBeingFetched = this.buttons.some((button) => button.icon() === 'fas fa-circle-notch fa-spin');\n\n return (\n
\n
\n {this.buttons.map((button) => WebsiteInputComponent.component({ button }))}\n\n
\n \n \n
\n\n \n \n
\n\n {Button.component(\n {\n type: 'submit',\n style: 'float: right;',\n className: 'Button Button--primary EditSocialButtons-save',\n loading: this.loading,\n // Disable save button if favicons are being fetched\n disabled: areAnyIconsBeingFetched,\n title: areAnyIconsBeingFetched\n ? app.translator.trans('fof-socialprofile.forum.edit.save_disabled_fetching_favicons')\n : null,\n },\n app.translator.trans('fof-socialprofile.forum.edit.submit')\n )}\n
\n \n \n );\n }\n\n data() {\n const buttons = [];\n\n this.buttons.forEach((button, index) => {\n if (button.title() !== '') {\n buttons[index] = {};\n buttons[index].title = button.title();\n buttons[index].url = button.url();\n buttons[index].icon = button.icon();\n buttons[index].favicon = button.favicon();\n }\n });\n\n return {\n socialButtons: JSON.stringify(buttons),\n };\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.attrs.user\n .save(this.data(), { errorHandler: this.onerror.bind(this) })\n .then(this.hide.bind(this))\n .then($('#app').trigger('refreshSocialButtons', [this.data().socialButtons]))\n .catch(() => {\n this.loading = false;\n m.redraw();\n });\n }\n\n addSocialButton() {\n this.createButtonObject(this.buttons.length);\n\n m.redraw();\n\n $('document').ready(() => {\n $(`#socialgroup-${this.buttons.length - 1}`).slideDown();\n });\n }\n\n delSocialButton() {\n const curdel = this.buttons.length - 1;\n\n $(`#socialgroup-${curdel}`).slideUp('normal', () => {\n this.buttons.splice(curdel, 1);\n m.redraw();\n });\n }\n\n createButtonObject(key, button = null) {\n if (button == null) {\n this.buttons[key] = {};\n this.buttons[key].index = Stream(key);\n this.buttons[key].favicon = Stream('none');\n this.buttons[key].title = Stream('');\n this.buttons[key].url = Stream('');\n this.buttons[key].icon = Stream('fas fa-globe');\n } else {\n this.buttons[key] = {};\n this.buttons[key].index = Stream(key);\n this.buttons[key].favicon = Stream(button.favicon);\n this.buttons[key].title = Stream(button.title);\n this.buttons[key].url = Stream(button.url);\n this.buttons[key].icon = Stream(button.icon);\n }\n }\n}\n","import app from 'flarum/forum/app';\nimport Model from 'flarum/common/Model';\nimport User from 'flarum/common/models/User';\nimport { extend } from 'flarum/common/extend';\nimport UserCard from 'flarum/forum/components/UserCard';\nimport Badge from 'flarum/common/components/Badge';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport classList from 'flarum/common/utils/classList';\n\nimport SocialButtonsModal from './components/SocialButtonsModal';\n\napp.initializers.add('fof/socialprofile', () => {\n User.prototype.socialButtons = Model.attribute('socialButtons', (str) => JSON.parse(str || '[]'));\n User.prototype.canViewSocialProfile = Model.attribute('canViewSocialProfile');\n User.prototype.canEditSocialProfile = Model.attribute('canEditSocialProfile');\n\n extend(UserCard.prototype, 'infoItems', function (items) {\n const user = this.attrs.user;\n\n if (!user.canViewSocialProfile()) {\n return;\n }\n\n this.canEdit = user.canEditSocialProfile();\n this.buttons = this.attrs.user.socialButtons();\n\n const buttonList = new ItemList();\n\n if (this.buttons.length) {\n this.buttons.forEach((button, index) => {\n if (button.title !== '' && button.icon !== '' && button.url !== '') {\n let buttonStyle = '';\n let buttonClassName = classList({\n [`social-button ${button.icon}-${index} social-icon-${index}`]: true,\n 'social-greyscale-button': button.icon === 'favicon-grey',\n });\n\n if (button.icon === 'favicon' || button.icon === 'favicon-grey') {\n if (app.forum.attribute('fof-socialprofile.allow_external_favicons')) {\n buttonStyle = `\n background-image: url(\"${button.favicon}\");\n background-size: 60%;\n background-position: center;\n background-repeat: no-repeat;\n `;\n } else {\n buttonClassName += ' fas fa-globe';\n }\n }\n\n buttonList.add(\n `social-icon-${index}`,\n \n {Badge.component({\n className: classList({ [buttonClassName]: true, 'social-icon--deleting': this.deleting }),\n type: `social`,\n icon: button.icon,\n label: button.title,\n style: buttonStyle,\n })}\n \n );\n }\n });\n\n if (this.canEdit) {\n buttonList.add(\n 'settings social-button',\n Badge.component({\n type: 'social social-settings',\n icon: 'fas fa-cog',\n label: app.translator.trans('fof-socialprofile.forum.edit.edit'),\n onclick: () => {\n app.modal.show(SocialButtonsModal, { user: this.attrs.user });\n },\n }),\n -1\n );\n }\n } else if (this.canEdit) {\n buttonList.add(\n 'settings social-button',\n Badge.component({\n type: 'social null-social-settings',\n icon: 'fas fa-plus',\n label: app.translator.trans('fof-socialprofile.forum.edit.add'),\n onclick: () => {\n app.modal.show(SocialButtonsModal, { user: this.attrs.user });\n },\n }),\n -1\n );\n }\n\n if (buttonList.toArray().length > 0) {\n if (items.has('lastSeen')) {\n items.replace('lastSeen', items['lastSeen'], 50);\n }\n if (items.has('joined')) {\n items.replace('joined', items['joined'], 40);\n }\n\n items.add('fofsocialprofile', buttonList.toArray(), 20);\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/socialprofile/webpack/bootstrap","webpack://@fof/socialprofile/external \"flarum.core.compat['forum/app']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/Model']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/models/User']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/helpers/icon']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/extend']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['forum/components/UserCard']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/Component']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/utils/withAttr']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['common/components/Dropdown']\"","webpack://@fof/socialprofile/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/socialprofile/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/socialprofile/./src/forum/components/IconSelectorComponent.js","webpack://@fof/socialprofile/./src/forum/components/WebsiteInputComponent.js","webpack://@fof/socialprofile/./src/forum/helpers/isValidUrl.js","webpack://@fof/socialprofile/./src/forum/helpers/extractBaseUrl.js","webpack://@fof/socialprofile/./src/forum/components/SocialButtonsModal.js","webpack://@fof/socialprofile/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","IconSelectorComponent","initAttrs","attrs","className","buttonClassName","menuClassName","oninit","vnode","this","icons","social","view","children","items","toArray","getButtonContent","ic","str","icon","test","selection","allowsExternal","classList","alt","src","favicon","onerror","select","caretIcon","ItemList","add","onclick","role","title","index","style","width","height","margin","forEach","curIcon","replace","Dropdown","WebsiteInputComponent","button","app","forum","attribute","id","type","placeholder","translator","trans","tabIndex","bidi","component","url","onchange","withAttr","onUrlChange","clearTimeout","waitUntilFinished","setTimeout","urlInstance","URL","_","includes","protocol","isValidUrl","iconurl","origin","extractBaseUrl","redraw","Component","SocialButtonsModal","buttons","user","socialButtons","length","createButtonObject","content","areAnyIconsBeingFetched","some","map","addSocialButton","delSocialButton","Button","loading","disabled","data","push","console","log","JSON","stringify","onsubmit","e","preventDefault","save","errorHandler","then","hide","$","trigger","ready","slideDown","curdel","slideUp","splice","Stream","Modal","initializers","User","Model","parse","canViewSocialProfile","canEditSocialProfile","extend","UserCard","canEdit","buttonList","buttonStyle","href","target","rel","Badge","deleting","label","modal","show","has"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8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tE,UAAU,CACZN,KAAM,8BACN/B,KAAM,cACN6G,MAAOlF,IAAIM,WAAWC,MAAM,oCAC5BrB,QAAS,WACLc,IAAImF,MAAMC,KAAKvD,EAAoB,CAAEE,KAAM,EAAK1E,MAAM0E,WAG7D,GAIL4C,EAAW1G,UAAUgE,OAAS,IAC1BjE,EAAMqH,IAAI,aACVrH,EAAM4B,QAAQ,WAAY5B,EAAK,SAAc,IAE7CA,EAAMqH,IAAI,WACVrH,EAAM4B,QAAQ,SAAU5B,EAAK,OAAY,IAG7CA,EAAMiB,IAAI,mBAAoB0F,EAAW1G,UAAW","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 16);\n","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['common/utils/Stream'];","module.exports = flarum.core.compat['common/utils/classList'];","module.exports = flarum.core.compat['common/utils/ItemList'];","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['common/models/User'];","module.exports = flarum.core.compat['common/components/Badge'];","module.exports = flarum.core.compat['common/helpers/icon'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/components/UserCard'];","module.exports = flarum.core.compat['common/components/Modal'];","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/utils/withAttr'];","module.exports = flarum.core.compat['common/components/Dropdown'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import Dropdown from 'flarum/common/components/Dropdown';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport icon from 'flarum/common/helpers/icon';\nimport classList from 'flarum/common/utils/classList';\n\nexport default class IconSelectorComponent extends Dropdown {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n attrs.className = 'icondropdown';\n attrs.buttonClassName = 'Button Button--icon';\n attrs.menuClassName = 'social-dropdown-menu';\n }\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.icons = {\n social: [\n 'fas fa-envelope',\n 'fas fa-globe',\n 'fab fa-amazon',\n 'fab fa-angellist',\n 'fab fa-apple',\n 'fab fa-behance',\n 'fab fa-bitbucket',\n 'fab fa-codepen',\n 'fab fa-connectdevelop',\n 'fab fa-dashcube',\n 'fab fa-delicious',\n 'fab fa-deviantart',\n 'fab fa-digg',\n 'fab fa-discord',\n 'fab fa-dribbble',\n 'fab fa-dropbox',\n 'fab fa-drupal',\n 'fab fa-facebook',\n 'fab fa-flickr',\n 'fab fa-foursquare',\n 'fab fa-get-pocket',\n 'fab fa-git',\n 'fab fa-github',\n 'fab fa-github-alt',\n 'fab fa-google',\n 'fab fa-google-plus',\n 'fab fa-google-wallet',\n 'fab fa-hacker-news',\n 'fab fa-instagram',\n 'fab fa-ioxhost',\n 'fab fa-joomla',\n 'fab fa-jsfiddle',\n 'fab fa-lastfm',\n 'fab fa-leanpub',\n 'fab fa-linkedin',\n 'fab fa-mastodon',\n 'fab fa-medium',\n 'fab fa-odnoklassniki',\n 'fab fa-opencart',\n 'fab fa-pagelines',\n 'fab fa-paypal',\n 'fab fa-pied-piper-alt',\n 'fab fa-pinterest-p',\n 'fab fa-playstation',\n 'fab fa-qq',\n 'fab fa-reddit',\n 'fab fa-renren',\n 'fab fa-sellsy',\n 'fas fa-share-alt',\n 'fab fa-shirtsinbulk',\n 'fab fa-simplybuilt',\n 'fab fa-skyatlas',\n 'fab fa-skype',\n 'fab fa-slack',\n 'fab fa-slideshare',\n 'fab fa-soundcloud',\n 'fab fa-spotify',\n 'fab fa-stack-exchange',\n 'fab fa-stack-overflow',\n 'fab fa-steam',\n 'fab fa-stumbleupon',\n 'fab fa-telegram',\n 'fab fa-tencent-weibo',\n 'fab fa-trello',\n 'fab fa-tripadvisor',\n 'fab fa-tumblr',\n 'fab fa-twitch',\n 'fab fa-twitter',\n 'fab fa-viacoin',\n 'fab fa-vimeo',\n 'fab fa-vine',\n 'fab fa-vk',\n 'fab fa-weibo',\n 'fab fa-weixin',\n 'fab fa-whatsapp',\n 'fab fa-wordpress',\n 'fab fa-xbox',\n 'fab fa-xing',\n 'fab fa-y-combinator',\n 'fab fa-yandex',\n 'fab fa-yandex-international',\n 'fab fa-yelp',\n 'fab fa-youtube',\n ],\n };\n }\n\n view(vnode) {\n vnode.children = this.items().toArray();\n\n return super.view(vnode);\n }\n\n getButtonContent() {\n const ic = (str) => icon(str, { className: 'icondropdown-activeIcon fa-fw' });\n\n return [\n /^favicon(-\\w+)?$/.test(this.attrs.selection())\n ? this.attrs.allowsExternal\n ? [\n {\n this.attrs.favicon('none');\n this.select(this.icons.social[0]);\n }}\n />,\n ]\n : ic('fas fa-globe')\n : ic(this.attrs.selection()),\n this.attrs.caretIcon ? icon(this.attrs.caretIcon, { className: 'Button-caret' }) : '',\n ];\n }\n\n items() {\n const items = new ItemList();\n\n if (this.attrs.favicon() !== 'none' && this.attrs.allowsExternal) {\n items.add(\n 'favicon',\n this.select('favicon')}\n role=\"button\"\n className={classList({\n 'iconpicker-item': true,\n 'iconpicker-item--highlighted': this.attrs.selection() === 'favicon',\n })}\n title=\"Favicon\"\n >\n \n ,\n 102\n );\n\n items.add(\n 'favicon-grey',\n this.select('favicon-grey')}\n role=\"button\"\n className={classList({\n 'iconpicker-item iconpicker-item--invertColors': true,\n 'iconpicker-item--highlighted': this.attrs.selection() === 'favicon-grey',\n })}\n title=\"Grey Favicon\"\n >\n \n ,\n 101\n );\n }\n\n this.icons.social.forEach((curIcon) => {\n items.add(\n curIcon.replace(/ /, '-'),\n this.select(curIcon)}\n className={classList({ 'iconpicker-item': true, 'iconpicker-item--highlighted': this.attrs.selection() === curIcon })}\n role=\"button\"\n title={`.${curIcon}`}\n >\n {icon(curIcon, { className: 'social-icon fa-fw' })}\n ,\n 100\n );\n });\n\n return items;\n }\n\n select(icon) {\n this.attrs.selection(icon);\n }\n}\n","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport extractBaseUrl from '../helpers/extractBaseUrl';\nimport isValidUrl from '../helpers/isValidUrl';\nimport IconSelectorComponent from './IconSelectorComponent';\n\nexport default class WebsiteInputComponent extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.button = this.attrs.button;\n\n this.allowsExternal = app.forum.attribute('fof-socialprofile.allow_external_favicons');\n }\n\n view(vnode) {\n return (\n
\n \n\n {IconSelectorComponent.component({\n selection: this.button.icon,\n favicon: this.button.favicon,\n index: this.button.index,\n allowsExternal: this.allowsExternal,\n })}\n\n \n\n \n\n \n
\n );\n }\n\n onUrlChange(value) {\n this.button.url(value);\n\n if (!this.allowsExternal) {\n return;\n }\n\n clearTimeout(this.waitUntilFinished);\n\n if (this.button.icon() !== 'fas fa-circle-notch fa-spin') {\n this.button.icon('fas fa-circle-notch fa-spin');\n this.button.favicon('none');\n }\n\n this.waitUntilFinished = setTimeout(() => {\n if (isValidUrl(this.button.url())) {\n const iconurl = `${extractBaseUrl(this.button.url())}/favicon.ico`;\n\n this.button.favicon(iconurl);\n this.button.icon('favicon');\n\n m.redraw();\n } else {\n this.button.icon('fas fa-globe');\n this.button.favicon('none');\n m.redraw();\n }\n }, 1000);\n }\n}\n","/**\n * Verifies if a string is a valid URL (http/https only).\n *\n * @param {string} url URL to test\n */\nexport default function isValidUrl(url) {\n let urlInstance;\n\n try {\n urlInstance = new URL(url);\n } catch (_) {\n return false;\n }\n\n return ['http:', 'https:'].includes(urlInstance.protocol);\n}\n","/**\n * Extracts the base URL of a specified URL. Returns `null` if the URL is invalid.\n *\n * @example\n * // https://www.google.com\n * extractBaseUrl(\"https://www.google.com/search?q=flarum\")\n *\n * @example\n * // https://discuss.flarum.org\n * extractBaseUrl(\"https://discuss.flarum.org/u/admin\")\n *\n * @example\n * // null\n * extractBaseUrl(\"javascript:alert('hello!')\")\n *\n * @param {string|null} url URL to extract base from\n */\nexport default function extractBaseUrl(url) {\n let urlInstance;\n\n try {\n urlInstance = new URL(url);\n } catch (_) {\n return null;\n }\n\n if (['http:', 'https:'].includes(urlInstance.protocol)) {\n return urlInstance.origin;\n }\n\n return null;\n}\n","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\nimport WebsiteInputComponent from './WebsiteInputComponent';\n\nexport default class SocialButtonsModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.buttons = [];\n const buttons = this.attrs.user.socialButtons();\n\n if (buttons.length) {\n buttons.forEach((button, index) => {\n if (button && button.title) {\n this.createButtonObject(index, button);\n }\n });\n } else {\n this.createButtonObject(0);\n }\n }\n\n className() {\n return 'SocialButtonsModal Modal--small';\n }\n\n title() {\n return app.translator.trans('fof-socialprofile.forum.edit.headtitle');\n }\n\n content() {\n const areAnyIconsBeingFetched = this.buttons.some((button) => button.icon() === 'fas fa-circle-notch fa-spin');\n\n return (\n
\n
\n {this.buttons.map((button) => WebsiteInputComponent.component({ button }))}\n\n
\n \n \n
\n\n \n \n
\n\n {Button.component(\n {\n type: 'submit',\n style: 'float: right;',\n className: 'Button Button--primary EditSocialButtons-save',\n loading: this.loading,\n // Disable save button if favicons are being fetched\n disabled: areAnyIconsBeingFetched,\n title: areAnyIconsBeingFetched\n ? app.translator.trans('fof-socialprofile.forum.edit.save_disabled_fetching_favicons')\n : null,\n },\n app.translator.trans('fof-socialprofile.forum.edit.submit')\n )}\n
\n \n \n );\n }\n\n data() {\n const buttons = [];\n\n this.buttons.forEach((button) => {\n if (button && button.title() && button.url()) {\n buttons.push({\n title: button.title(),\n url: button.url(),\n icon: button.icon(),\n favicon: button.favicon(),\n });\n }\n });\n\n console.log(JSON.stringify(buttons));\n\n return {\n socialButtons: JSON.stringify(buttons),\n };\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.attrs.user\n .save(this.data(), { errorHandler: this.onerror.bind(this) })\n .then(this.hide.bind(this))\n .then($('#app').trigger('refreshSocialButtons', [this.data().socialButtons]))\n .catch(() => {\n this.loading = false;\n m.redraw();\n });\n }\n\n addSocialButton() {\n this.createButtonObject(this.buttons.length);\n\n m.redraw();\n\n $('document').ready(() => {\n $(`#socialgroup-${this.buttons.length - 1}`).slideDown();\n });\n }\n\n delSocialButton() {\n const curdel = this.buttons.length - 1;\n\n $(`#socialgroup-${curdel}`).slideUp('normal', () => {\n this.buttons.splice(curdel, 1);\n m.redraw();\n });\n }\n\n createButtonObject(key, button = null) {\n if (button == null) {\n this.buttons[key] = {};\n this.buttons[key].index = Stream(key);\n this.buttons[key].favicon = Stream('none');\n this.buttons[key].title = Stream('');\n this.buttons[key].url = Stream('');\n this.buttons[key].icon = Stream('fas fa-globe');\n } else {\n this.buttons[key] = {};\n this.buttons[key].index = Stream(key);\n this.buttons[key].favicon = Stream(button.favicon);\n this.buttons[key].title = Stream(button.title);\n this.buttons[key].url = Stream(button.url);\n this.buttons[key].icon = Stream(button.icon);\n }\n }\n}\n","import app from 'flarum/forum/app';\nimport Model from 'flarum/common/Model';\nimport User from 'flarum/common/models/User';\nimport { extend } from 'flarum/common/extend';\nimport UserCard from 'flarum/forum/components/UserCard';\nimport Badge from 'flarum/common/components/Badge';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport classList from 'flarum/common/utils/classList';\n\nimport SocialButtonsModal from './components/SocialButtonsModal';\n\napp.initializers.add('fof/socialprofile', () => {\n User.prototype.socialButtons = Model.attribute('socialButtons', (str) => JSON.parse(str || '[]'));\n User.prototype.canViewSocialProfile = Model.attribute('canViewSocialProfile');\n User.prototype.canEditSocialProfile = Model.attribute('canEditSocialProfile');\n\n extend(UserCard.prototype, 'infoItems', function (items) {\n const user = this.attrs.user;\n\n if (!user.canViewSocialProfile()) {\n return;\n }\n\n this.canEdit = user.canEditSocialProfile();\n this.buttons = this.attrs.user.socialButtons();\n\n const buttonList = new ItemList();\n\n if (this.buttons.length) {\n this.buttons.forEach((button, index) => {\n if (button && button.title && button.icon && button.url) {\n let buttonStyle = '';\n let buttonClassName = classList({\n [`social-button ${button.icon}-${index} social-icon-${index}`]: true,\n 'social-greyscale-button': button.icon === 'favicon-grey',\n });\n\n if (button.icon === 'favicon' || button.icon === 'favicon-grey') {\n if (app.forum.attribute('fof-socialprofile.allow_external_favicons')) {\n buttonStyle = `\n background-image: url(\"${button.favicon}\");\n background-size: 60%;\n background-position: center;\n background-repeat: no-repeat;\n `;\n } else {\n buttonClassName += ' fas fa-globe';\n }\n }\n\n buttonList.add(\n `social-icon-${index}`,\n \n {Badge.component({\n className: classList({ [buttonClassName]: true, 'social-icon--deleting': this.deleting }),\n type: `social`,\n icon: button.icon,\n label: button.title,\n style: buttonStyle,\n })}\n \n );\n }\n });\n\n if (this.canEdit) {\n buttonList.add(\n 'settings social-button',\n Badge.component({\n type: 'social social-settings',\n icon: 'fas fa-cog',\n label: app.translator.trans('fof-socialprofile.forum.edit.edit'),\n onclick: () => {\n app.modal.show(SocialButtonsModal, { user: this.attrs.user });\n },\n }),\n -1\n );\n }\n } else if (this.canEdit) {\n buttonList.add(\n 'settings social-button',\n Badge.component({\n type: 'social null-social-settings',\n icon: 'fas fa-plus',\n label: app.translator.trans('fof-socialprofile.forum.edit.add'),\n onclick: () => {\n app.modal.show(SocialButtonsModal, { user: this.attrs.user });\n },\n }),\n -1\n );\n }\n\n if (buttonList.toArray().length > 0) {\n if (items.has('lastSeen')) {\n items.replace('lastSeen', items['lastSeen'], 50);\n }\n if (items.has('joined')) {\n items.replace('joined', items['joined'], 40);\n }\n\n items.add('fofsocialprofile', buttonList.toArray(), 20);\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file