<?xml version="1.0" encoding="utf-8"?>
<addon addon_id="ahDiscordWidget" title="[AH] Discord Widget" version_string="1.0.2" version_id="1" url="" install_callback_class="" install_callback_method="" uninstall_callback_class="" uninstall_callback_method="">
<admin_navigation/>
<admin_permissions/>
<admin_style_properties/>
<admin_templates/>
<admin_template_modifications/>
<code_events/>
<code_event_listeners/>
<cron/>
<email_templates/>
<email_template_modifications/>
<optiongroups>
<group group_id="ahDiscordWidget" display_order="9999" debug_only="0"/>
<option option_id="ahDiscordWidgetAlph" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="400"/>
</option>
<option option_id="ahDiscordWidgetCollapse" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="510"/>
</option>
<option option_id="ahDiscordWidgetEnableSidebar" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="200"/>
</option>
<option option_id="ahDiscordWidgetHide" edit_format="textbox" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="420"/>
</option>
<option option_id="ahDiscordWidgetHideAll" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="410"/>
</option>
<option option_id="ahDiscordWidgetInvite" edit_format="textbox" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="320"/>
</option>
<option option_id="ahDiscordWidgetInviteNewTab" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="330"/>
</option>
<option option_id="ahDiscordWidgetJoin" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="300"/>
</option>
<option option_id="ahDiscordWidgetJoinText" edit_format="textbox" data_type="string" can_backup="1">
<default_value>Join Server</default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="310"/>
</option>
<option option_id="ahDiscordWidgetServerID" edit_format="textbox" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="100"/>
</option>
<option option_id="ahDiscordWidgetShowUsers" edit_format="onoff" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="500"/>
</option>
<option option_id="ahDiscordWidgetStyle" edit_format="template" data_type="string" can_backup="1">
<default_value></default_value>
<edit_format_params>ah_discord_widget_style</edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="101"/>
</option>
<option option_id="ahDiscordWidgetTitle" edit_format="textbox" data_type="string" can_backup="1">
<default_value>Our Discord</default_value>
<edit_format_params></edit_format_params>
<sub_options></sub_options>
<relation group_id="ahDiscordWidget" display_order="220"/>
</option>
</optiongroups>
<permissions>
<permission_groups>
<permission_group permission_group_id="ahDiscordWidget"/>
</permission_groups>
<permissions>
<permission permission_group_id="ahDiscordWidget" permission_id="ahDiscordWidgetView" permission_type="flag" default_value="unset" interface_group_id="ahDiscordWidget" display_order="1"/>
</permissions>
<interface_groups>
<interface_group interface_group_id="ahDiscordWidget" display_order="9999"/>
</interface_groups>
</permissions>
<phrases>
<phrase title="option_ahDiscordWidgetAlph" version_id="1" version_string="1.0.0"><![CDATA[Alphabetical?]]></phrase>
<phrase title="option_ahDiscordWidgetAlph_explain" version_id="1" version_string="1.0.0"><![CDATA[Checking this box will display the channel list in alphabetical order.]]></phrase>
<phrase title="option_ahDiscordWidgetCollapse" version_id="1" version_string="1.0.0"><![CDATA[Collapse All Users List by Default?]]></phrase>
<phrase title="option_ahDiscordWidgetCollapse_explain" version_id="1" version_string="1.0.0"><![CDATA[Checking this option will keep the all users list collapsed by default.]]></phrase>
<phrase title="option_ahDiscordWidgetEnableSidebar" version_id="1" version_string="1.0.0"><![CDATA[Enable on Sidebar?]]></phrase>
<phrase title="option_ahDiscordWidgetEnableSidebar_explain" version_id="1" version_string="1.0.0"><![CDATA[<p style="color: red;">Only enable this if you are not using [bd] Widget Framework.</p>
<br />
<p>If you are using [bd] Widget Framework, you can create a widget with the "[Advanced] HTML & Template (without wrapper)" render and use "ah_discord_widget" for the template name.</p>]]></phrase>
<phrase title="option_ahDiscordWidgetHide" version_id="1" version_string="1.0.0"><![CDATA[Hide Specific Channels?]]></phrase>
<phrase title="option_ahDiscordWidgetHideAll" version_id="1" version_string="1.0.0"><![CDATA[Hide All Channels?]]></phrase>
<phrase title="option_ahDiscordWidgetHideAll_explain" version_id="1" version_string="1.0.0"><![CDATA[Checking this option will hide ALL channels. If you only want to hide specific channels, make sure this is unchecked.]]></phrase>
<phrase title="option_ahDiscordWidgetHide_explain" version_id="1" version_string="1.0.0"><![CDATA[Make sure to follow this format if you want to hide specific channels.
<br />
<br />
<span style="color:red;">'Channel Name 1', Channel Name 2'</span>]]></phrase>
<phrase title="option_ahDiscordWidgetInvite" version_id="1" version_string="1.0.0"><![CDATA[Invite Link]]></phrase>
<phrase title="option_ahDiscordWidgetInviteNewTab" version_id="1" version_string="1.0.0"><![CDATA[Open in New Tab?]]></phrase>
<phrase title="option_ahDiscordWidgetInviteNewTab_explain" version_id="1" version_string="1.0.0"><![CDATA[Checking this option will open the invite link in a new tab.]]></phrase>
<phrase title="option_ahDiscordWidgetInvite_explain" version_id="1" version_string="1.0.0"><![CDATA[If you have chosen to show the "Join Server" button, you need to specify an invite link. The invite link <span style="color:red;">MUST</span> be set to never expire. If you need help obtaining an invite link, click <a href="https://support.discordapp.com/hc/en-us/articles/204155938-How-do-I-invite-friends-to-my-server-" target="_blank">here</a>.]]></phrase>
<phrase title="option_ahDiscordWidgetJoin" version_id="1" version_string="1.0.0"><![CDATA[Show "Join Server" button?]]></phrase>
<phrase title="option_ahDiscordWidgetJoinText" version_id="1" version_string="1.0.0"><![CDATA[Button Text]]></phrase>
<phrase title="option_ahDiscordWidgetJoinText_explain" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="option_ahDiscordWidgetJoin_explain" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="option_ahDiscordWidgetServerID" version_id="1" version_string="1.0.0"><![CDATA[Server ID]]></phrase>
<phrase title="option_ahDiscordWidgetServerID_explain" version_id="1" version_string="1.0.0"><![CDATA[If you need help locating your server ID, click <a href="https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-" target="_blank">here</a>.]]></phrase>
<phrase title="option_ahDiscordWidgetShowUsers" version_id="1" version_string="1.0.0"><![CDATA[Show All Users List?]]></phrase>
<phrase title="option_ahDiscordWidgetShowUsers_explain" version_id="1" version_string="1.0.0"><![CDATA[Checking this option will show the all users list.]]></phrase>
<phrase title="option_ahDiscordWidgetStyle" version_id="1" version_string="1.0.0"><![CDATA[Style]]></phrase>
<phrase title="option_ahDiscordWidgetStyle_explain" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="option_ahDiscordWidgetTitle" version_id="1" version_string="1.0.0"><![CDATA[Sidebar Block Title]]></phrase>
<phrase title="option_ahDiscordWidgetTitle_explain" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="option_group_ahDiscordWidget" version_id="1" version_string="1.0.0"><![CDATA[[AH] Discord Widget]]></phrase>
<phrase title="option_group_ahDiscordWidget_description" version_id="1" version_string="1.0.0"><![CDATA[These options control the Discord Widget.]]></phrase>
<phrase title="permission_ahDiscordWidget_ahDiscordWidgetView" version_id="1" version_string="1.0.0"><![CDATA[View Discord Widget]]></phrase>
<phrase title="permission_group_ahDiscordWidget" version_id="1" version_string="1.0.0"><![CDATA[[AH] Discord Widget]]></phrase>
<phrase title="permission_interface_ahDiscordWidget" version_id="1" version_string="1.0.0"><![CDATA[[AH] Discord Widget]]></phrase>
<phrase title="style_property_ahDiscordWidgetAllUsersListToggle_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetAllUsersListToggle_master" version_id="1" version_string="1.0.0"><![CDATA[All Users List Toggle]]></phrase>
<phrase title="style_property_ahDiscordWidgetAllUsersList_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetAllUsersList_master" version_id="1" version_string="1.0.0"><![CDATA[All Users List]]></phrase>
<phrase title="style_property_ahDiscordWidgetChannel_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetChannel_master" version_id="1" version_string="1.0.0"><![CDATA[Channel]]></phrase>
<phrase title="style_property_ahDiscordWidgetJoin_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetJoin_master" version_id="1" version_string="1.0.0"><![CDATA[Join Button]]></phrase>
<phrase title="style_property_ahDiscordWidgetTree_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetTree_master" version_id="1" version_string="1.0.0"><![CDATA[Tree]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserAvatar_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserAvatar_master" version_id="1" version_string="1.0.0"><![CDATA[User Avatar]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserList_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserList_master" version_id="1" version_string="1.0.0"><![CDATA[Channel User List]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserPlaying_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserPlaying_master" version_id="1" version_string="1.0.0"><![CDATA[User Playing]]></phrase>
<phrase title="style_property_ahDiscordWidgetUsersOnline_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUsersOnline_master" version_id="1" version_string="1.0.0"><![CDATA[Users Online Text]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserStatusIdle_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserStatusIdle_master" version_id="1" version_string="1.0.0"><![CDATA[User Status Idle]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserStatusOnline_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserStatusOnline_master" version_id="1" version_string="1.0.0"><![CDATA[User Status Online]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserStatus_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUserStatus_master" version_id="1" version_string="1.0.0"><![CDATA[User Status]]></phrase>
<phrase title="style_property_ahDiscordWidgetUser_description_master" version_id="1" version_string="1.0.0"><![CDATA[]]></phrase>
<phrase title="style_property_ahDiscordWidgetUser_master" version_id="1" version_string="1.0.0"><![CDATA[User]]></phrase>
<phrase title="style_property_group_ahDiscordWidget_master" version_id="1" version_string="1.0.0"><![CDATA[[AH] Discord Widget]]></phrase>
<phrase title="style_property_group_ahDiscordWidget_master_desc" version_id="1" version_string="1.0.0"><![CDATA[These style properties control the Discord Widget.]]></phrase>
</phrases>
<route_prefixes/>
<style_properties>
<property property_name="ahDiscordWidgetChannel" property_type="css" definition="1" group_name="ahDiscordWidget" title="Channel" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="2" sub_group=""><![CDATA[{"color":"@contentText","extra":"list-style-type: none !important;\npadding-left: 0px !important;","font-weight":"bold"}]]></property>
<property property_name="ahDiscordWidgetTree" property_type="css" definition="1" group_name="ahDiscordWidget" title="Tree" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="1" sub_group=""><![CDATA[{"extra":"display: block;\nlist-style-type: none !important;"}]]></property>
<property property_name="ahDiscordWidgetAllUsersList" property_type="css" definition="1" group_name="ahDiscordWidget" title="All Users List" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="4" sub_group=""><![CDATA[{"extra":"overflow: scroll;\noverflow-x: hidden;","height":"210px"}]]></property>
<property property_name="ahDiscordWidgetUserStatus" property_type="css" definition="1" group_name="ahDiscordWidget" title="User Status" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="8" sub_group=""><![CDATA[{"background-color":"pink","border-radius":"50%","extra":"position: absolute;\ntop: 14px;\nleft: 14px;\nborder: 1px solid #3a3a3a !important;","height":"10px","width":"10px"}]]></property>
<property property_name="ahDiscordWidgetUserStatusOnline" property_type="scalar" definition="1" group_name="ahDiscordWidget" title="User Status Online" description="" css_components="" scalar_type="color" scalar_parameters="" display_order="50" sub_group=""><![CDATA[#43b581]]></property>
<property property_name="ahDiscordWidgetUserStatusIdle" property_type="scalar" definition="1" group_name="ahDiscordWidget" title="User Status Idle" description="" css_components="" scalar_type="color" scalar_parameters="" display_order="56" sub_group=""><![CDATA[#faa61a]]></property>
<property property_name="ahDiscordWidgetUserList" property_type="css" definition="1" group_name="ahDiscordWidget" title="Channel User List" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="3" sub_group=""><![CDATA[{"extra":"padding-left: 10px !important;\nlist-style-type: none !important;"}]]></property>
<property property_name="ahDiscordWidgetUser" property_type="css" definition="1" group_name="ahDiscordWidget" title="User" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="6" sub_group=""><![CDATA[{"extra":"position: relative;\nwhite-space: nowrap;\noverflow: hidden;"}]]></property>
<property property_name="ahDiscordWidgetUserPlaying" property_type="css" definition="1" group_name="ahDiscordWidget" title="User Playing" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="9" sub_group=""><![CDATA[{"extra":"opacity: .5;","font-size":".8em"}]]></property>
<property property_name="ahDiscordWidgetUsersOnline" property_type="css" definition="1" group_name="ahDiscordWidget" title="Users Online Text" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="10" sub_group=""><![CDATA[{"extra":"font-size: 1em !important;\ntext-align: right;\nmargin: 10px 10px 0 0 !important;\npadding-bottom: 5px !important;"}]]></property>
<property property_name="ahDiscordWidgetUserAvatar" property_type="css" definition="1" group_name="ahDiscordWidget" title="User Avatar" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="7" sub_group=""><![CDATA[{"border-radius":"100%","extra":"display: inline;\nborder: solid 2px #fff !important;\nborder-color: #3a3a3a !important;\nmargin-right: 5px !important;\nvertical-align: middle;","height":"24px","width":"24px"}]]></property>
<property property_name="ahDiscordWidgetAllUsersListToggle" property_type="css" definition="1" group_name="ahDiscordWidget" title="All Users List Toggle" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="5" sub_group=""><![CDATA[{"extra":"cursor: default;\n-webkit-touch-callout: none;\n-webkit-user-select: none;\n-khtml-user-select: none;\n-moz-user-select: none;\n-ms-user-select: none;\nuser-select: none"}]]></property>
<property property_name="ahDiscordWidgetJoin" property_type="css" definition="1" group_name="ahDiscordWidget" title="Join Button" description="" css_components="text,background,border,layout,extra" scalar_type="" scalar_parameters="" display_order="12" sub_group=""><![CDATA[[]]]></property>
<group group_name="ahDiscordWidget" display_order="9999">
<title>[AH] Discord Widget</title>
<description>These style properties control the Discord Widget.</description>
</group>
</style_properties>
<templates>
<template title="ah_discord_widget" version_id="1" version_string="1.0.0"><![CDATA[<xen:require css="ah_discord_widget.css" />
<xen:if is="{$visitor.permissions.ahDiscordWidget.ahDiscordWidgetView}">
<div class="section discord">
<script type="text/javascript"><xen:include template="ah_discord_widget_js" /></script>
<script type="text/javascript">
discordWidget.init({
serverId: '{$xenOptions.ahDiscordWidgetServerID}',
title: '{$xenOptions.ahDiscordWidgetTitle}',
join: <xen:if is="{$xenOptions.ahDiscordWidgetJoin}">true<xen:else />false</xen:if>,
alphabetical: <xen:if is="{$xenOptions.ahDiscordWidgetAlph}">true<xen:else />false</xen:if>,
theme: 'dark',
hideChannels: <xen:if is="{$xenOptions.ahDiscordWidgetHideAll}">true<xen:else />[{xen:raw $xenOptions.ahDiscordWidgetHide}]</xen:if>,
showAllUsers: <xen:if is="{$xenOptions.ahDiscordWidgetShowUsers}">true<xen:else />false</xen:if>,
allUsersDefaultState: <xen:if is="!{$xenOptions.ahDiscordWidgetCollapse}">true<xen:else />false</xen:if>
});
discordWidget.render();
</script>
<div class="discord-widget secondaryContent"></div>
</div>
</xen:if>]]></template>
<template title="ah_discord_widget.css" version_id="1" version_string="1.0.0"><![CDATA[.discord-widget {
margin: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline
}
.discord-widget div,
.discord-widget span,
.discord-widget applet,
.discord-widget object,
.discord-widget iframe,
.discord-widget h1,
.discord-widget h2,
.discord-widget h3,
.discord-widget h4,
.discord-widget h5,
.discord-widget h6,
.discord-widget p,
.discord-widget blockquote,
.discord-widget pre,
.discord-widget abbr,
.discord-widget acronym,
.discord-widget address,
.discord-widget big,
.discord-widget cite,
.discord-widget code,
.discord-widget del,
.discord-widget dfn,
.discord-widget em,
.discord-widget img,
.discord-widget ins,
.discord-widget kbd,
.discord-widget q,
.discord-widget s,
.discord-widget samp,
.discord-widget small,
.discord-widget strike,
.discord-widget strong,
.discord-widget sub,
.discord-widget sup,
.discord-widget tt,
.discord-widget var,
.discord-widget b,
.discord-widget u,
.discord-widget i,
.discord-widget center,
.discord-widget dl,
.discord-widget dt,
.discord-widget dd,
.discord-widget ol,
.discord-widget ul,
.discord-widget li,
.discord-widget fieldset,
.discord-widget form,
.discord-widget label,
.discord-widget legend,
.discord-widget table,
.discord-widget caption,
.discord-widget tbody,
.discord-widget tfoot,
.discord-widget thead,
.discord-widget tr,
.discord-widget th,
.discord-widget td,
.discord-widget article,
.discord-widget aside,
.discord-widget canvas,
.discord-widget details,
.discord-widget embed,
.discord-widget figure,
.discord-widget figcaption,
.discord-widget footer,
.discord-widget header,
.discord-widget hgroup,
.discord-widget menu,
.discord-widget nav,
.discord-widget output,
.discord-widget ruby,
.discord-widget section,
.discord-widget summary,
.discord-widget time,
.discord-widget mark,
.discord-widget audio,
.discord-widget video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: middle
}
.discord-widget article,
.discord-widget aside,
.discord-widget details,
.discord-widget figcaption,
.discord-widget figure,
.discord-widget footer,
.discord-widget header,
.discord-widget hgroup,
.discord-widget menu,
.discord-widget nav,
.discord-widget section {
display: block
}
.discord-widget body {
line-height: 1
}
.discord-widget ol,
.discord-widget ul {
list-style: none
}
.discord-widget blockquote,
.discord-widget q {
quotes: none
}
.discord-widget blockquote:before,
.discord-widget blockquote:after,
.discord-widget q:before,
.discord-widget q:after {
content: '';
content: none
}
.discord-widget table {
border-collapse: collapse;
border-spacing: 0
}
span.discord-error {
color: red;
font-size: 1.25em
}
.discord-title {
margin: -15px!important;
margin-bottom: 5px!important;
height: 32px;
line-height: 32px!important;
background-color: #333;
border: solid 1px #222!important;
padding-left: 10px!important;
font-weight: bold!important;
font-size: 1.17em!important
}
.discord-tree {
{xen:property ahDiscordWidgetTree}
}
.discord-channel {
{xen:property ahDiscordWidgetChannel}
}
.discord-userlist {
{xen:property ahDiscordWidgetUserList}
}
.discord-user {
{xen:property ahDiscordWidgetUser}
}
.discord-user span {
{xen:property ahDiscordWidgetUserPlaying}
}
.discord-user-status {
{xen:property ahDiscordWidgetUserStatus}
}
.discord-online {
background-color: {xen:property ahDiscordWidgetUserStatusOnline};
}
.discord-idle {
background-color: {xen:property ahDiscordWidgetUserStatusIdle};
}
.discord-avatar {
{xen:property ahDiscordWidgetUserAvatar}
}
.discord-allusers-toggle {
{xen:property ahDiscordWidgetAllUsersListToggle}
}
.discord-users-online {
{xen:property ahDiscordWidgetUsersOnline}
}
.discord-userlist.discord-allusers {
{xen:property ahDiscordWidgetAllUsersList}
}
.discord-join {
text-align: center;
}
.joinButton {
{xen:property ahDiscordWidgetJoin}
}]]></template>
<template title="ah_discord_widget_js" version_id="1" version_string="1.0.0"><![CDATA[var discordWidget = discordWidget || (function() {
var b = {};
var a = "1.1";
return {
init: function(c) {
c.serverId = typeof c.serverId !== "undefined" ? c.serverId : false;
c.title = typeof c.title !== "undefined" ? c.title : false;
c.join = typeof c.join !== "undefined" ? c.join : true;
c.alphabetical = typeof c.alphabetical !== "undefined" ? c.alphabetical : false;
c.theme = typeof c.theme !== "undefined" ? c.theme : "light";
c.hideChannels = typeof c.hideChannels !== "undefined" ? c.hideChannels : false;
c.showAllUsers = typeof c.showAllUsers !== "undefined" ? c.showAllUsers : false;
c.allUsersDefaultState = typeof c.allUsersDefaultState !== "undefined" ? c.allUsersDefaultState : true;
c.showNick = typeof c.showNick !== "undefined" ? c.showNick : true;
b.serverId = c.serverId;
b.title = c.title;
b.join = c.join;
b.alphabetical = c.alphabetical;
b.theme = c.theme;
b.hideChannels = c.hideChannels;
b.showAllUsers = c.showAllUsers;
b.allUsersDefaultState = c.allUsersDefaultState;
b.showNick = c.showNick
},
render: function() {
if (window.jQuery) {
d()
} else {
var c = document.createElement("script");
c.type = "text/javascript";
c.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js";
document.head.appendChild(c);
c.onload = function() {
d()
}
}
function d() {
var h = "https://discordapp.com/api/servers/" + b.serverId + "/embed.json";
var i = new XMLHttpRequest();
i.onreadystatechange = function() {
if (i.readyState == 4 && i.status == 200) {
var l = JSON.parse(i.responseText);
j(l, b);
if (!b.allUsersDefaultState) {
$(".discord-allusers").toggle();
$(".discord-allusers-toggle").html("▸ Online Users")
}
$(".discord-allusers-toggle").click(function() {
$(".discord-allusers").toggle(100, function() {
if ($(".discord-allusers").is(":visible")) {
$(".discord-allusers-toggle").html("▾ Online Users")
} else {
$(".discord-allusers-toggle").html("▸ Online Users")
}
})
})
} else {
if (i.readyState == 4 && i.status == 404) {
j("404", b)
} else {
if (i.readyState == 4) {
j(i.status, b)
}
}
}
};
i.open("GET", h, true);
i.send();
function e(m, l) {
if (m.position < l.position) {
return -1
}
if (m.position > l.position) {
return 1
}
return 0
}
function g(l) {
return '<li class="discord-channel">' + l + '</li><ul class="discord-userlist">'
}
function f(o, m) {
var l = "";
if (b.showNick == true && o.nick) {
l = o.nick
} else {
l = o.username
}
var n = "";
if (o.game) {
n = " - " + o.game.name
}
if (o.channel_id == m) {
if (o.status != "online") {
return '<li class="discord-user"><img src="' + o.avatar_url + '" class="discord-avatar"/><div class="discord-user-status discord-idle"></div>' + l + "<span>" + n + "</span></li>"
} else {
return '<li class="discord-user"><img src="' + o.avatar_url + '" class="discord-avatar"/><div class="discord-user-status discord-online"></div>' + l + "<span>" + n + "</span></li>"
}
} else {
return ""
}
}
function j(y, n) {
var z = $(".discord-widget")[0];
$(z).attr("version", a);
var A = '<ul class="discord-tree"></ul><p class="discord-users-online"></p><p class="discord-join"></p><div class="discord-fade"></div>';
var u = "";
var r = "";
var l, w, x;
var v, m, q, o;
if (n.title !== false) {
z.innerHTML = '<div class="secondaryContent"><h3>' + n.title + "</h3></div>" + A;
l = $(".discord-tree")[0]
} else {
z.innerHTML = A;
l = $(".discord-tree")[0];
l.style.marginTop = "0"
}
switch (y) {
case "404":
l.innerHTML = '<span class="discord-error">Invalid Server ID</span>';
break;
case "522":
l.innerHTML = '<span class="discord-error">Discord is having issues.</span>';
break
}
if (!y) {
l.innerHTML = y;
return
}
w = $(".discord-users-online")[0];
x = $(".discord-join")[0];
if (typeof(n.hideChannels) !== "boolean" || !n.hideChannels) {
if (n.alphabetical) {
v = [];
o = [];
for (var t = 0; t < y.channels.length; t++) {
q = false;
for (var s = 0; s < n.hideChannels.length; s++) {
if (y.channels[t].name.indexOf(n.hideChannels[s]) >= 0) {
q = true
}
}
if (!q) {
v.push(y.channels[t])
} else {
o.push(y.channels[t].id)
}
}
for (var t = 0; t < v.length; t++) {
u += g(v[t].name);
for (var s = 0; s < y.members.length; s++) {
u += f(y.members[s], v[t].id)
}
u += "</ul>"
}
} else {
v = [];
o = [];
for (var t = 0; t < y.channels.length; t++) {
q = false;
for (var s = 0; s < n.hideChannels.length; s++) {
if (y.channels[t].name.indexOf(n.hideChannels[s]) >= 0) {
q = true
}
}
if (!q) {
v.push(y.channels[t])
} else {
o.push(y.channels[t].id)
}
}
v.sort(e);
for (var t = 0; t < v.length; t++) {
u += g(v[t].name);
for (var s = 0; s < y.members.length; s++) {
u += f(y.members[s], v[t].id)
}
u += "</ul>"
}
}
}
if (n.showAllUsers) {
u += '<li class="discord-channel discord-allusers-toggle">▾ Online Users</li><ul class="discord-userlist discord-allusers">';
for (var t = 0; t < y.members.length; t++) {
if (!y.members[t].channel_id || $.inArray(y.members[t].channel_id, o) >= 0) {
u += f(y.members[t], y.members[t].channel_id)
}
}
u += "</ul>"
}
var B = "";
if (y.instant_invite != "null") {
B = '<a href="{$xenOptions.ahDiscordWidgetInvite}" <xen:if is="{$xenOptions.ahDiscordWidgetInviteNewTab}">target="_blank"<xen:else /></xen:if> class="button joinButton">{$xenOptions.ahDiscordWidgetJoinText}</a>'
}
l.innerHTML = u;
w.innerHTML = "Users Online: " + y.members.length;
if (n.join) {
x.innerHTML = B
} else {
x.style.display = "none"
}
}
}
}
}
}());]]></template>
</templates>
<public_template_modifications>
<modification template="forum_list" modification_key="ahDiscordWidgetSidebar" description="Enables the discord widget on the sidebar in the forum list." execution_order="10" enabled="1" action="str_replace">
<find><![CDATA[<xen:hook name="forum_list_sidebar">]]></find>
<replace><![CDATA[<xen:hook name="forum_list_sidebar">
<xen:if is="{$xenOptions.ahDiscordWidgetEnableSidebar}">
<xen:include template="ah_discord_widget" />
</xen:if>]]></replace>
</modification>
</public_template_modifications>
<bb_code_media_sites/>
<bb_codes/>
</addon>