From 7cb0048920c4b7393fc37cf465aede3fc728910e Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Tue, 9 Feb 2021 18:32:57 +0000 Subject: [PATCH] Bundled output for commit 15cfa401bfc29acdec383df2629eb56292d0a220 [skip ci] --- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index 22596b9..1f1e1e7 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var o={};function a(i){if(o[i])return o[i].exports;var n=o[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=o,a.d=function(t,o,i){a.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:i})},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 i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var n in t)a.d(i,n,function(o){return t[o]}.bind(null,n));return i},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=13)}([function(t,o){t.exports=flarum.core.compat["utils/Stream"]},function(t,o){t.exports=flarum.core.compat["components/Badge"]},function(t,o){t.exports=flarum.core.compat["utils/ItemList"]},function(t,o){t.exports=flarum.core.compat["components/Modal"]},function(t,o){t.exports=flarum.core.compat["components/Button"]},function(t,o){t.exports=flarum.core.compat["helpers/icon"]},function(t,o){t.exports=flarum.core.compat.Model},function(t,o){t.exports=flarum.core.compat["models/User"]},function(t,o){t.exports=flarum.core.compat.extend},function(t,o){t.exports=flarum.core.compat["components/UserCard"]},function(t,o){t.exports=flarum.core.compat.Component},function(t,o){t.exports=flarum.core.compat["utils/withAttr"]},function(t,o){t.exports=flarum.core.compat["components/Dropdown"]},function(t,o,a){"use strict";a.r(o);var i=a(6),n=a.n(i),e=a(7),s=a.n(e),r=a(8),c=a(9),l=a.n(c),f=a(1),u=a.n(f),p=a(2),b=a.n(p);function d(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o}var h=a(3),v=a.n(h),g=a(4),y=a.n(g),x=a(0),w=a.n(x),B=a(10),k=a.n(B),S=a(11),N=a.n(S);var j=a(12),O=a.n(j),_=a(5),E=a.n(_),F=function(t){function o(){return t.apply(this,arguments)||this}d(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;return[/^favicon(-\w+)?$/.test(this.attrs.selection())?[m("img",{className:"favicon-grey"===this.attrs.selection()?"social-greyscale-button":"social-button",style:{width:"14px",height:"14px"},alt:"favicon",src:this.attrs.favicon(),onerror:function(){t.attrs.favicon("none"),t.select(t.icons.social[0])}})]:E()(this.attrs.selection(),{}),this.attrs.caretIcon?E()(this.attrs.caretIcon,{className:"Button-caret"}):""]},a.items=function(){var t=this,o=new b.a;return"none"!==this.attrs.favicon()&&(o.add("favicon",m("div",{onclick:function(){return t.select("favicon")},role:"button",className:"iconpicker-item "+("favicon"===this.attrs.selection()?"iconpicker--highlighted":""),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:"iconpicker-item-invt "+("favicon-grey"===this.attrs.selection()?"iconpicker--highlighted":""),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){var i=w()();t.attrs.selection()===a&&i("iconpicker--highlighted"),o.add(a.replace(/ /,"-"),m("div",{onclick:function(){return t.select(a)},className:"iconpicker-item "+i(),role:"button",title:"."+a},E()(a,{className:"social-icon"})),100)})),o},a.select=function(t){this.attrs.selection(t)},o}(O.a),M=function(t){function o(){return t.apply(this,arguments)||this}d(o,t);var a=o.prototype;return a.oninit=function(o){t.prototype.oninit.call(this,o),this.button=this.attrs.button},a.view=function(){return m("div",{className:"Form-group form-group-social",id:"socialgroup-"+this.button.index()},m("input",{type:"text",className:"SocialFormControl SocialTitle",placeholder:app.translator.trans("fof-socialprofile.forum.edit.title"),tabIndex:2*(this.button.index()+1)-1,bidi:this.button.title}),F.component({selection:this.button.icon,favicon:this.button.favicon,index:this.button.index}),m("input",{type:"text",className:"SocialFormControl Socialurl",placeholder:app.translator.trans("fof-socialprofile.forum.edit.url"),tabIndex:2*(this.button.index()+1),value:this.button.url(),onchange:N()("value",this.onUrlChange.bind(this))}),m("input",{type:"hidden",className:"SocialFormControl SocialIcon",id:"icon"+this.button.index()+"-icon",bidi:this.button.icon}),m("input",{type:"hidden",className:"SocialFormControl Socialfavicon",id:"icon"+this.button.index()+"-favicon",bidi:this.button.favicon}))},a.onUrlChange=function(t){var o=this;this.button.url(t),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}(k.a),C=function(t){function o(){return t.apply(this,arguments)||this}d(o,t);var a=o.prototype;return a.oninit=function(o){var a=this;t.prototype.oninit.call(this,o),this.buttons=[];var i=this.attrs.user.socialButtons();i.length?i.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 M.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"})),y.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=w()(t),this.buttons[t].favicon=w()("none"),this.buttons[t].title=w()(""),this.buttons[t].url=w()(""),this.buttons[t].icon=w()("fas fa-globe")):(this.buttons[t]={},this.buttons[t].index=w()(t),this.buttons[t].favicon=w()(o.favicon),this.buttons[t].title=w()(o.title),this.buttons[t].url=w()(o.url),this.buttons[t].icon=w()(o.icon))},o}(v.a),U=function(t){function o(){return t.apply(this,arguments)||this}d(o,t);var a=o.prototype;return a.oninit=function(o){var a=this;t.prototype.oninit.call(this,o),this.buttons=[],this.index=this.attrs.index;var i=this.attrs.user.socialButtons();this.button=i[this.index],i.forEach((function(t,o){a.createButtonObject(o,t)}))},a.className=function(){return"SocialButtonsModal Modal--small"},a.title=function(){return app.translator.trans("fof-socialprofile.forum.edit.deletetitle")},a.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form"},m("h3",{className:"SocialProfile-title"},this.button.title),m("p",{className:"SocialProfile-url"},this.button.url),m("div",{className:"Form-group",id:"submit-button-group"},y.a.component({type:"submit",className:"Button Button--primary EditSocialButtons-delete",loading:this.loading},app.translator.trans("fof-socialprofile.forum.edit.delete")))))},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.buttons.splice(this.index,1),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.createButtonObject=function(t,o){void 0===o&&(o=null),null==o?(this.buttons[t]={},this.buttons[t].index=w()(t),this.buttons[t].favicon=w()("none"),this.buttons[t].title=w()(""),this.buttons[t].url=w()(""),this.buttons[t].icon=w()("fas fa-globe")):(this.buttons[t]={},this.buttons[t].index=w()(t),this.buttons[t].favicon=w()(o.favicon),this.buttons[t].title=w()(o.title),this.buttons[t].url=w()(o.url),this.buttons[t].icon=w()(o.icon))},o}(v.a);app.initializers.add("fof/socialprofile",(function(){s.a.prototype.socialButtons=n.a.attribute("socialButtons",(function(t){return JSON.parse(t||"[]")})),Object(r.extend)(l.a.prototype,"infoItems",(function(t){var o=this;this.isSelf=app.session.user===this.attrs.user,this.canEdit=!!app.session.user&&app.session.user.data.attributes.canEdit,this.buttons=this.attrs.user.socialButtons();var a=new b.a;this.buttons.length?(this.buttons.forEach((function(t,i){if(""!==t.title&&""!==t.icon&&""!==t.url){var n="",e="";"favicon"===t.icon||"favicon-grey"===t.icon?(n='background-image: url("'+t.favicon+'");background-size: 60%;background-position: 50% 50%;background-repeat: no-repeat;',e="favicon-grey"===t.icon?t.icon+"-"+i+" social-button social-greyscale-button":t.icon+"-"+i+" social-button"):(n="",e=t.icon+"-"+i+" social-button"),a.add(e+(o.deleting?" social-button--highlightable":""),u.a.component({type:"social social-icon-"+i,icon:t.icon,label:t.title,style:n,onclick:function(){o.deleting?app.modal.show(U,{user:o.attrs.user,index:i}):window.open(t.url,"_blank")}}))}})),this.isSelf?a.add("settings social-button",u.a.component({type:"social social-settings",icon:"fas fa-cog",label:app.translator.trans("fof-socialprofile.forum.edit.edit"),onclick:function(){app.modal.show(C,{user:o.attrs.user})}}),-1):this.canEdit&&a.add("settings social-button",u.a.component({type:"social social-moderate "+(this.deleting?"social-moderate--highlighted":""),icon:"fas fa-exclamation-triangle",label:app.translator.trans("fof-socialprofile.forum.edit.delete"),onclick:function(){o.deleting=!o.deleting}}),-1)):this.isSelf&&a.add("settings social-button",u.a.component({type:"social null-social-settings",icon:"fas fa-plus",label:app.translator.trans("fof-socialprofile.forum.edit.add"),onclick:function(){app.modal.show(C,{user:o.attrs.user})}}),-1),a.toArray().length>0&&(t.has("lastSeen")&&t.replace("lastSeen",t.lastSeen,50),t.has("joined")&&t.replace("joined",t.joined,40),t.add("fofsocialprofile",a.toArray(),20))}))}))}]); +module.exports=function(t){var o={};function n(a){if(o[a])return o[a].exports;var i=o[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=o,n.d=function(t,o,a){n.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:a})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,o){if(1&o&&(t=n(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var i in t)n.d(a,i,function(o){return t[o]}.bind(null,i));return a},n.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(o,"a",o),o},n.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},n.p="",n(n.s=14)}([function(t,o){t.exports=flarum.core.compat["utils/Stream"]},function(t,o){t.exports=flarum.core.compat["utils/classList"]},function(t,o){t.exports=flarum.core.compat["components/Badge"]},function(t,o){t.exports=flarum.core.compat["utils/ItemList"]},function(t,o){t.exports=flarum.core.compat["components/Modal"]},function(t,o){t.exports=flarum.core.compat["components/Button"]},function(t,o){t.exports=flarum.core.compat["helpers/icon"]},function(t,o){t.exports=flarum.core.compat.Model},function(t,o){t.exports=flarum.core.compat["models/User"]},function(t,o){t.exports=flarum.core.compat.extend},function(t,o){t.exports=flarum.core.compat["components/UserCard"]},function(t,o){t.exports=flarum.core.compat.Component},function(t,o){t.exports=flarum.core.compat["utils/withAttr"]},function(t,o){t.exports=flarum.core.compat["components/Dropdown"]},function(t,o,n){"use strict";n.r(o);var a=n(7),i=n.n(a),e=n(8),s=n.n(e),r=n(9),c=n(10),l=n.n(c),f=n(2),u=n.n(f),p=n(3),b=n.n(p),d=n(1),h=n.n(d);function v(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o}var g=n(4),y=n.n(g),x=n(5),w=n.n(x),B=n(0),k=n.n(B),N=n(11),S=n.n(N),j=n(12),O=n.n(j);var F=n(13),C=n.n(F),_=n(6),E=n.n(_),M=function(t){function o(){return t.apply(this,arguments)||this}v(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 n=o.prototype;return n.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"]}},n.view=function(o){return o.children=this.items().toArray(),t.prototype.view.call(this,o)},n.getButtonContent=function(){var t=this;return[/^favicon(-\w+)?$/.test(this.attrs.selection())?[m("img",{className:h()({"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])}})]:E()(this.attrs.selection(),{className:"icondropdown-activeIcon fa-fw"}),this.attrs.caretIcon?E()(this.attrs.caretIcon,{className:"Button-caret"}):""]},n.items=function(){var t=this,o=new b.a;return"none"!==this.attrs.favicon()&&(o.add("favicon",m("div",{onclick:function(){return t.select("favicon")},role:"button",className:h()({"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:h()({"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(n){o.add(n.replace(/ /,"-"),m("div",{onclick:function(){return t.select(n)},className:h()({"iconpicker-item":!0,"iconpicker-item--highlighted":t.attrs.selection()===n}),role:"button",title:"."+n},E()(n,{className:"social-icon fa-fw"})),100)})),o},n.select=function(t){this.attrs.selection(t)},o}(C.a),U=function(t){function o(){return t.apply(this,arguments)||this}v(o,t);var n=o.prototype;return n.oninit=function(o){t.prototype.oninit.call(this,o),this.button=this.attrs.button},n.view=function(){return m("div",{className:"Form-group form-group-social",id:"socialgroup-"+this.button.index()},m("input",{type:"text",className:"SocialFormControl SocialFormControl-title",placeholder:app.translator.trans("fof-socialprofile.forum.edit.title"),tabIndex:2*(this.button.index()+1)-1,bidi:this.button.title}),M.component({selection:this.button.icon,favicon:this.button.favicon,index:this.button.index}),m("input",{type:"text",className:"SocialFormControl SocialFormControl-url",placeholder:app.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:"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}))},n.onUrlChange=function(t){var o=this;this.button.url(t),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}(S.a),I=function(t){function o(){return t.apply(this,arguments)||this}v(o,t);var n=o.prototype;return n.oninit=function(o){var n=this;t.prototype.oninit.call(this,o),this.buttons=[];var a=this.attrs.user.socialButtons();a.length?a.forEach((function(t,o){""!==t.title&&n.createButtonObject(o,t)})):this.createButtonObject(0)},n.className=function(){return"SocialButtonsModal Modal--small"},n.title=function(){return app.translator.trans("fof-socialprofile.forum.edit.headtitle")},n.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 U.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"})),w.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")))))},n.data=function(){var t=[];return this.buttons.forEach((function(o,n){""!==o.title()&&(t[n]={},t[n].title=o.title(),t[n].url=o.url(),t[n].icon=o.icon(),t[n].favicon=o.favicon())})),{socialButtons:JSON.stringify(t)}},n.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()}))},n.addSocialButton=function(){var t=this;this.createButtonObject(this.buttons.length),m.redraw(),$("document").ready((function(){$("#socialgroup-"+(t.buttons.length-1)).slideDown()}))},n.delSocialButton=function(){var t=this,o=this.buttons.length-1;$("#socialgroup-"+o).slideUp("normal",(function(){t.buttons.splice(o,1),m.redraw()}))},n.createButtonObject=function(t,o){void 0===o&&(o=null),null==o?(this.buttons[t]={},this.buttons[t].index=k()(t),this.buttons[t].favicon=k()("none"),this.buttons[t].title=k()(""),this.buttons[t].url=k()(""),this.buttons[t].icon=k()("fas fa-globe")):(this.buttons[t]={},this.buttons[t].index=k()(t),this.buttons[t].favicon=k()(o.favicon),this.buttons[t].title=k()(o.title),this.buttons[t].url=k()(o.url),this.buttons[t].icon=k()(o.icon))},o}(y.a),P=function(t){function o(){return t.apply(this,arguments)||this}v(o,t);var n=o.prototype;return n.oninit=function(o){var n=this;t.prototype.oninit.call(this,o),this.buttons=[],this.index=this.attrs.index;var a=this.attrs.user.socialButtons();this.button=a[this.index],a.forEach((function(t,o){n.createButtonObject(o,t)}))},n.className=function(){return"SocialButtonsModal Modal--small"},n.title=function(){return app.translator.trans("fof-socialprofile.forum.edit.deletetitle")},n.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form"},m("h3",{className:"SocialProfile-title"},this.button.title),m("p",{className:"SocialProfile-url"},this.button.url),m("div",{className:"Form-group",id:"submit-button-group"},w.a.component({type:"submit",className:"Button Button--primary EditSocialButtons-delete",loading:this.loading},app.translator.trans("fof-socialprofile.forum.edit.delete")))))},n.data=function(){var t=[];return this.buttons.forEach((function(o,n){""!==o.title()&&(t[n]={},t[n].title=o.title(),t[n].url=o.url(),t[n].icon=o.icon(),t[n].favicon=o.favicon())})),{socialButtons:JSON.stringify(t)}},n.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,this.buttons.splice(this.index,1),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()}))},n.createButtonObject=function(t,o){void 0===o&&(o=null),null==o?(this.buttons[t]={},this.buttons[t].index=k()(t),this.buttons[t].favicon=k()("none"),this.buttons[t].title=k()(""),this.buttons[t].url=k()(""),this.buttons[t].icon=k()("fas fa-globe")):(this.buttons[t]={},this.buttons[t].index=k()(t),this.buttons[t].favicon=k()(o.favicon),this.buttons[t].title=k()(o.title),this.buttons[t].url=k()(o.url),this.buttons[t].icon=k()(o.icon))},o}(y.a);app.initializers.add("fof/socialprofile",(function(){s.a.prototype.socialButtons=i.a.attribute("socialButtons",(function(t){return JSON.parse(t||"[]")})),Object(r.extend)(l.a.prototype,"infoItems",(function(t){var o=this;this.isSelf=app.session.user===this.attrs.user,this.canEdit=!!app.session.user&&app.session.user.data.attributes.canEdit,this.buttons=this.attrs.user.socialButtons();var n=new b.a;this.buttons.length?(this.buttons.forEach((function(t,a){if(""!==t.title&&""!==t.icon&&""!==t.url){var i,e,s="",r=h()(((i={})["social-button "+t.icon+"-"+a+" social-icon-"+a]=!0,i["social-greyscale-button"]="favicon-grey"===t.icon,i));"favicon"!==t.icon&&"favicon-grey"!==t.icon||(s='\n background-image: url("'+t.favicon+'");\n background-size: 60%;\n background-position: center;\n background-repeat: no-repeat;\n '),n.add("social-icon-"+a,u.a.component({className:h()((e={},e[r]=!0,e["social-icon--deleting"]=o.deleting,e)),type:"social",icon:t.icon,label:t.title,style:s,onclick:function(){o.deleting?app.modal.show(P,{user:o.attrs.user,index:a}):window.open(t.url,"_blank")}}))}})),this.isSelf?n.add("settings social-button",u.a.component({type:"social social-settings",icon:"fas fa-cog",label:app.translator.trans("fof-socialprofile.forum.edit.edit"),onclick:function(){app.modal.show(I,{user:o.attrs.user})}}),-1):this.canEdit&&n.add("settings social-button",u.a.component({type:"social social-moderate "+(this.deleting?"social-moderate--highlighted":""),icon:"fas fa-exclamation-triangle",label:app.translator.trans("fof-socialprofile.forum.edit.delete"),onclick:function(){o.deleting=!o.deleting}}),-1)):this.isSelf&&n.add("settings social-button",u.a.component({type:"social null-social-settings",icon:"fas fa-plus",label:app.translator.trans("fof-socialprofile.forum.edit.add"),onclick:function(){app.modal.show(I,{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 ba5dc1b..532eed3 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['utils/Stream']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Badge']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Button']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['helpers/icon']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['Model']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['models/User']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['extend']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/UserCard']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['Component']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['utils/withAttr']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Dropdown']\"","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/components/DeleteButtonModal.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","_inheritsLoose","subClass","superClass","constructor","__proto__","IconSelectorComponent","initAttrs","attrs","className","buttonClassName","menuClassName","oninit","vnode","this","icons","social","view","children","items","toArray","getButtonContent","test","selection","style","width","height","alt","src","favicon","onerror","select","icon","caretIcon","ItemList","add","onclick","role","title","index","margin","forEach","curIcon","highlighted","Stream","replace","Dropdown","WebsiteInputComponent","button","id","type","placeholder","app","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","Modal","DeleteButtonModal","initializers","User","Model","attribute","str","parse","extend","UserCard","isSelf","session","canEdit","attributes","buttonList","buttonStyle","deleting","Badge","label","modal","show","window","open","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,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAA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E,KAAM,EAAKtE,MAAMsE,WAG7D,GAEEhE,KAAK0G,SACZE,EAAWvF,IACP,yBACA0F,IAAMpE,UAAU,CACZP,KAAM,2BAA0BpC,KAAK8G,SAAW,+BAAiC,IACjF5F,KAAM,8BACN8F,MAAO1E,IAAIC,WAAWC,MAAM,uCAC5BlB,QAAS,WACL,EAAKwF,UAAY,EAAKA,aAG7B,IAGF9G,KAAKwG,QACZI,EAAWvF,IACP,yBACA0F,IAAMpE,UAAU,CACZP,KAAM,8BACNlB,KAAM,cACN8F,MAAO1E,IAAIC,WAAWC,MAAM,oCAC5BlB,QAAS,WACLgB,IAAI2E,MAAMC,KAAKpD,EAAoB,CAAEE,KAAM,EAAKtE,MAAMsE,WAG7D,GAIL4C,EAAWtG,UAAU4D,OAAS,IAC1B7D,EAAMgH,IAAI,aACVhH,EAAM0B,QAAQ,WAAY1B,EAAK,SAAc,IAE7CA,EAAMgH,IAAI,WACVhH,EAAM0B,QAAQ,SAAU1B,EAAK,OAAY,IAG7CA,EAAMgB,IAAI,mBAAoBuF,EAAWtG,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 = 13);\n","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['components/Badge'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/UserCard'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['utils/withAttr'];","module.exports = flarum.core.compat['components/Dropdown'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Dropdown from 'flarum/components/Dropdown';\nimport ItemList from 'flarum/utils/ItemList';\nimport icon from 'flarum/helpers/icon';\nimport Stream from 'flarum/utils/Stream';\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 return [\n /^favicon(-\\w+)?$/.test(this.attrs.selection())\n ? [\n {\n this.attrs.favicon('none');\n this.select(this.icons.social[0]);\n }}\n />,\n ]\n : icon(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') {\n items.add(\n 'favicon',\n this.select('favicon')}\n role=\"button\"\n className={`iconpicker-item ${this.attrs.selection() === 'favicon' ? 'iconpicker--highlighted' : ''}`}\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={`iconpicker-item-invt ${this.attrs.selection() === 'favicon-grey' ? 'iconpicker--highlighted' : ''}`}\n title=\"Grey Favicon\"\n >\n \n ,\n 101\n );\n }\n\n this.icons.social.forEach((curIcon) => {\n const highlighted = Stream();\n\n if (this.attrs.selection() === curIcon) {\n highlighted('iconpicker--highlighted');\n }\n\n items.add(\n curIcon.replace(/ /, '-'),\n
this.select(curIcon)} className={`iconpicker-item ${highlighted()}`} role=\"button\" title={`.${curIcon}`}>\n {icon(curIcon, { className: 'social-icon' })}\n
,\n 100\n );\n });\n\n return items;\n }\n\n select(icon) {\n this.attrs.selection(icon);\n }\n}\n","import Component from 'flarum/Component';\nimport withAttr from 'flarum/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\n view() {\n return (\n
\n \n\n {IconSelectorComponent.component({\n selection: this.button.icon,\n favicon: this.button.favicon,\n index: this.button.index,\n })}\n\n \n\n \n\n \n
\n );\n }\n\n onUrlChange(value) {\n this.button.url(value);\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/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from 'flarum/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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class DeleteButtonModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.buttons = [];\n this.index = this.attrs.index;\n const buttons = this.attrs.user.socialButtons();\n this.button = buttons[this.index];\n\n buttons.forEach((button, index) => {\n this.createButtonObject(index, button);\n });\n }\n\n className() {\n return 'SocialButtonsModal Modal--small';\n }\n\n title() {\n return app.translator.trans('fof-socialprofile.forum.edit.deletetitle');\n }\n\n content() {\n return (\n
\n
\n

{this.button.title}

\n

{this.button.url}

\n\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary EditSocialButtons-delete',\n loading: this.loading,\n },\n app.translator.trans('fof-socialprofile.forum.edit.delete')\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 this.buttons.splice(this.index, 1);\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 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 Model from 'flarum/Model';\nimport User from 'flarum/models/User';\nimport { extend } from 'flarum/extend';\nimport UserCard from 'flarum/components/UserCard';\nimport Badge from 'flarum/components/Badge';\nimport ItemList from 'flarum/utils/ItemList';\n\nimport SocialButtonsModal from './components/SocialButtonsModal';\nimport DeleteButtonModal from './components/DeleteButtonModal';\n\napp.initializers.add('fof/socialprofile', () => {\n User.prototype.socialButtons = Model.attribute('socialButtons', (str) => JSON.parse(str || '[]'));\n\n // extend(UserCard.prototype, 'init', function () {\n // $('#app').on('refreshSocialButtons', (e, buttons) => {\n // this.buttons = JSON.parse(buttons || '[]');\n // this.attrs.user.socialButtons(this.buttons);\n // this.attrs.user.freshness = new Date();\n // m.redraw();\n // });\n // });\n\n extend(UserCard.prototype, 'infoItems', function (items) {\n this.isSelf = app.session.user === this.attrs.user;\n this.canEdit = app.session.user ? app.session.user.data.attributes.canEdit : false;\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 = '';\n\n if (button.icon === 'favicon' || button.icon === 'favicon-grey') {\n buttonStyle = `background-image: url(\"${button.favicon}\");background-size: 60%;background-position: 50% 50%;background-repeat: no-repeat;`;\n if (button.icon === 'favicon-grey') {\n buttonClassName = `${button.icon}-${index} social-button social-greyscale-button`;\n } else {\n buttonClassName = `${button.icon}-${index} social-button`;\n }\n } else {\n buttonStyle = '';\n buttonClassName = `${button.icon}-${index} social-button`;\n }\n buttonList.add(\n `${buttonClassName}${this.deleting ? ' social-button--highlightable' : ''}`,\n Badge.component({\n type: `social social-icon-${index}`,\n icon: button.icon,\n label: button.title,\n style: buttonStyle,\n onclick: () => {\n if (this.deleting) {\n app.modal.show(DeleteButtonModal, {\n user: this.attrs.user,\n index,\n });\n } else {\n window.open(button.url, '_blank');\n }\n },\n })\n );\n }\n });\n\n if (this.isSelf) {\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 } else if (this.canEdit) {\n buttonList.add(\n 'settings social-button',\n Badge.component({\n type: `social social-moderate ${this.deleting ? 'social-moderate--highlighted' : ''}`,\n icon: 'fas fa-exclamation-triangle',\n label: app.translator.trans('fof-socialprofile.forum.edit.delete'),\n onclick: () => {\n this.deleting = !this.deleting;\n },\n }),\n -1\n );\n }\n } else if (this.isSelf) {\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['utils/Stream']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Badge']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Button']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['helpers/icon']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['Model']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['models/User']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['extend']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/UserCard']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['Component']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['utils/withAttr']\"","webpack://@fof/socialprofile/external \"flarum.core.compat['components/Dropdown']\"","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/components/DeleteButtonModal.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","_inheritsLoose","subClass","superClass","constructor","__proto__","IconSelectorComponent","initAttrs","attrs","className","buttonClassName","menuClassName","oninit","vnode","this","icons","social","view","children","items","toArray","getButtonContent","test","selection","classList","alt","src","favicon","onerror","select","icon","caretIcon","ItemList","add","onclick","role","title","index","style","width","height","margin","forEach","curIcon","replace","Dropdown","WebsiteInputComponent","button","id","type","placeholder","app","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","DeleteButtonModal","initializers","User","Model","attribute","str","parse","extend","UserCard","isSelf","session","canEdit","attributes","buttonList","buttonStyle","Badge","deleting","label","modal","show","window","open","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,EA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OAAS,IAC1B5D,EAAMgH,IAAI,aACVhH,EAAMyB,QAAQ,WAAYzB,EAAK,SAAc,IAE7CA,EAAMgH,IAAI,WACVhH,EAAMyB,QAAQ,SAAUzB,EAAK,OAAY,IAG7CA,EAAMc,IAAI,mBAAoByF,EAAWtG,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 = 14);\n","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['components/Badge'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/UserCard'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['utils/withAttr'];","module.exports = flarum.core.compat['components/Dropdown'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Dropdown from 'flarum/components/Dropdown';\nimport ItemList from 'flarum/utils/ItemList';\nimport icon from 'flarum/helpers/icon';\nimport classList from 'flarum/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 return [\n /^favicon(-\\w+)?$/.test(this.attrs.selection())\n ? [\n {\n this.attrs.favicon('none');\n this.select(this.icons.social[0]);\n }}\n />,\n ]\n : icon(this.attrs.selection(), { className: 'icondropdown-activeIcon fa-fw' }),\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') {\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 Component from 'flarum/Component';\nimport withAttr from 'flarum/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\n view() {\n return (\n
\n \n\n {IconSelectorComponent.component({\n selection: this.button.icon,\n favicon: this.button.favicon,\n index: this.button.index,\n })}\n\n \n\n \n\n \n
\n );\n }\n\n onUrlChange(value) {\n this.button.url(value);\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/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from 'flarum/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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class DeleteButtonModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.buttons = [];\n this.index = this.attrs.index;\n const buttons = this.attrs.user.socialButtons();\n this.button = buttons[this.index];\n\n buttons.forEach((button, index) => {\n this.createButtonObject(index, button);\n });\n }\n\n className() {\n return 'SocialButtonsModal Modal--small';\n }\n\n title() {\n return app.translator.trans('fof-socialprofile.forum.edit.deletetitle');\n }\n\n content() {\n return (\n
\n
\n

{this.button.title}

\n

{this.button.url}

\n\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary EditSocialButtons-delete',\n loading: this.loading,\n },\n app.translator.trans('fof-socialprofile.forum.edit.delete')\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 this.buttons.splice(this.index, 1);\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 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 Model from 'flarum/Model';\nimport User from 'flarum/models/User';\nimport { extend } from 'flarum/extend';\nimport UserCard from 'flarum/components/UserCard';\nimport Badge from 'flarum/components/Badge';\nimport ItemList from 'flarum/utils/ItemList';\nimport classList from 'flarum/utils/classList';\n\nimport SocialButtonsModal from './components/SocialButtonsModal';\nimport DeleteButtonModal from './components/DeleteButtonModal';\n\napp.initializers.add('fof/socialprofile', () => {\n User.prototype.socialButtons = Model.attribute('socialButtons', (str) => JSON.parse(str || '[]'));\n\n extend(UserCard.prototype, 'infoItems', function (items) {\n this.isSelf = app.session.user === this.attrs.user;\n this.canEdit = app.session.user ? app.session.user.data.attributes.canEdit : false;\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 buttonStyle = `\n background-image: url(\"${button.favicon}\");\n background-size: 60%;\n background-position: center;\n background-repeat: no-repeat;\n `;\n }\n\n buttonList.add(\n `social-icon-${index}`,\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 onclick: () => {\n if (this.deleting) {\n app.modal.show(DeleteButtonModal, {\n user: this.attrs.user,\n index,\n });\n } else {\n window.open(button.url, '_blank');\n }\n },\n })\n );\n }\n });\n\n if (this.isSelf) {\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 } else if (this.canEdit) {\n buttonList.add(\n 'settings social-button',\n Badge.component({\n type: `social social-moderate ${this.deleting ? 'social-moderate--highlighted' : ''}`,\n icon: 'fas fa-exclamation-triangle',\n label: app.translator.trans('fof-socialprofile.forum.edit.delete'),\n onclick: () => {\n this.deleting = !this.deleting;\n },\n }),\n -1\n );\n }\n } else if (this.isSelf) {\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