-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheqdkp_shadowlands.js
292 lines (255 loc) · 10.5 KB
/
eqdkp_shadowlands.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
$(function() {
if(mmocms_header_type == 'full'){
//Fixed Menu
$(window).on('scroll', function() {
var topMenu = $('#nav');
var topBody = $('body');
if($(document).scrollTop() > ($("#banner").outerHeight() + $("#personalArea").outerHeight())){
if(!topMenu.hasClass("jsFixed")){
topMenu.addClass('jsFixed');
topBody.addClass('jsFixedBody');
}
} else {
topMenu.removeClass('jsFixed');
topBody.removeClass('jsFixedBody');
}
//ScrollToTop
var heightWindow = $(window).height();
var heightDocument = $(document).height();
if($(document).scrollTop() > (heightWindow-(heightWindow/2))){
$('.toTopContainer').show();
} else {
$('.toTopContainer').hide();
}
});
//Mobile Swipe
if($( window ).width() < 900) {
var open = 'none';
//Enable swiping...
$("body").swipe( {
//Single swipe handler for left swipes
swipeRight:function(event, direction, distance, duration, fingerCount) {
if(open == 'none'){
$('.nav-mobile .mobile-overlay').show();
open = 'menu';
}else if(open == 'user'){
$('.nav-mobile .mobile-overlay-user').hide();
open = "none";
}
},
swipeLeft:function(event, direction, distance, duration, fingerCount) {
if(open == 'none'){
$('.nav-mobile .mobile-overlay-user').show();
open = "user";
}else if(open == 'menu'){
$('.nav-mobile .mobile-overlay').hide();
open = "none";
}
},
excludedElements: "label, button, input, select, textarea, table", // Here your list of excluded elements ...
threshold:130
});
}
/* My Chars Points */
$('.mychars-points-tooltip .char').on('click', function(){
$(this).parent().parent().children('tr').removeClass("active");
$(this).parent().addClass("active");
var current = $(this).parent().find('.current').html();
var icons = $(this).parent().find('.icons').html();
$(".mychars-points-target").html(icons + " "+current);
var id = $(this).parent().attr('id');
if(JQisLocalStorageNameSupported()) localStorage.setItem('mcp_'+mmocms_userid, id);
});
var saved = (JQisLocalStorageNameSupported()) ? localStorage.getItem('mcp_'+mmocms_userid) : "";
if (saved && saved != "" && $('#'+saved).find('.current').html() != undefined){
$('#'+saved).addClass("active");
var current = $('#'+saved).find('.current').html();
var icons = $('#'+saved).find('.icons').html();
$(".mychars-points-target").html(icons + " "+current);
} else {
$('.mychars-points-tooltip .main').addClass("active");
var current = $('.mychars-points-tooltip .main').find('.current').html();
var icons = $('.mychars-points-tooltip .main').find('.icons').html();
$(".mychars-points-target").html(icons + " "+current);
}
/* Main Menu */
$('ul.mainmenu li.link_li_indexphp a.link_indexphp, ul.mainmenu li.link_li_entry_home a.link_entry_home').html('');
/* Mobile Menu */
var mobile_menu_wrapper = $('.mainmenu-mobile-wrapper, .adminmenu-mobile-wrapper'),
mobile_menu_position = [];
mobile_menu_wrapper.find('a.sub-menu-arrow').after('<span class="sub-menu-trigger hand"><i class="fa fa-chevron-right"></i></span>');
mobile_menu_wrapper.find('a.sub-menu-arrow, .sub-menu-trigger').on('click', function(){
var depth = $(this).parentsUntil(mobile_menu_wrapper).parents('.sub-menu').length,
is_admin = $(this).parentsUntil(mobile_menu_wrapper).last().hasClass('adminmenu-mobile');
if( $(this).parent().hasClass('open') ){
if(is_admin && depth == 0) $('.mainmenu-mobile-wrapper').removeClass('hidden');
mobile_menu_wrapper.css('transform','translate3d('+( -100 * depth)+'% ,0,0)');
$(this).parent().removeClass('open');
mobile_menu_wrapper.removeClass('open');
$('.nav-mobile .mobile-overlay').scrollTop( mobile_menu_position.pop() );
}else{
mobile_menu_position.push( $('.nav-mobile .mobile-overlay').scrollTop() );
$(this).parent().addClass('open');
mobile_menu_wrapper.addClass('open');
mobile_menu_wrapper.css('transform','translate3d('+( -100 * (depth + 1))+'% ,0,0)');
if(is_admin && depth == 0) $('.mainmenu-mobile-wrapper').addClass('hidden');
$('.nav-mobile .mobile-overlay').scrollTop(0);
}
});
var mobile_usermenu_wrapper = $('.usermenu-mobile-wrapper');
var mobile_usermenu_position = [];
mobile_usermenu_wrapper.find('a.sub-menu-arrow').after('<span class="sub-menu-trigger hand"><i class="fa fa-chevron-right"></i></span>');
mobile_usermenu_wrapper.find('a.sub-menu-arrow, .sub-menu-trigger').on('click', function(){
var depth = $(this).parentsUntil(mobile_usermenu_wrapper).parents('.sub-menu').length;
if( $(this).parent().hasClass('open') ){
mobile_usermenu_wrapper.css('transform','translate3d('+( -100 * depth)+'% ,0,0)');
$(this).parent().removeClass('open');
mobile_usermenu_wrapper.removeClass('open');
$('.nav-mobile .mobile-overlay-user').scrollTop( mobile_usermenu_position.pop() );
}else{
mobile_usermenu_position.push( $(' .nav-mobile .mobile-overlay-user').scrollTop() );
$(this).parent().addClass('open');
mobile_usermenu_wrapper.addClass('open');
mobile_usermenu_wrapper.css('transform','translate3d('+( -100 * (depth + 1))+'% ,0,0)');
$('.nav-mobile .mobile-overlay-user').scrollTop(0);
}
});
/* Tooltip Triggers */
$('.tooltip-trigger').on('click', function(event){
event.preventDefault();
var mytooltip = $(this).data('tooltip');
$("#"+mytooltip).show('fast');
$(document).on('click', function(event) {
var count = $(event.target).parents('.'+mytooltip+'-container').length;
if (count == 0){
$("#"+mytooltip).hide('fast');
}
});
});
/* User Tooltip Doubleclick */
$('.user-tooltip-trigger').on('dblclick', function(event){
$("#user-tooltip").hide('fast');
window.location=mmocms_controller_path+"Settings"+mmocms_seo_extension+mmocms_sid;
});
/* Admin Tooltip Doubleclick */
$('.admin-tooltip-trigger').on('dblclick', function(event){
$("#admin-tooltip").hide('fast');
window.location=mmocms_root_path+"admin"+mmocms_sid;
});
user_clock();
$( ".openLoginModal" ).on('click', function() {
$( "#dialog-login" ).dialog( "open" );
});
/* Notifications */
$('.notification-tooltip-trigger').on('click', function(event){
$(".notification-tooltip").hide('fast');
$("#notification-tooltip-all").show('fast');
notification_show_only('all');
var classList = $(this).attr('class').split(/\s+/);
for (var i = 0; i < classList.length; i++) {
if (classList[i] === 'notification-bubble-red' || classList[i] === 'notification-bubble-yellow' || classList[i] === 'notification-bubble-green') {
notification_show_only(classList[i]);
break;
}
}
$(document).on('click', function(event) {
var count = $(event.target).parents('.notification-tooltip-container').length;
if (count == 0 && (!$(event.target).hasClass('notification-markasread')) ){
$(".notification-tooltip").hide('fast');
}
});
});
$('.notification-content').on('click', '.notification-markasread', function() {
var ids = $(this).parent().parent().data('ids');
$(this).parent().parent().remove();
recalculate_notification_bubbles();
$.get(mmocms_controller_path+"Notifications"+mmocms_seo_extension+mmocms_sid+"&markread&ids="+ids);
});
$('.notification-filter').on('click', function(event){
if ($(this).hasClass('filtered')){
//Show all of this
if ($(this).hasClass('notification-bubble-green')) $('.notification-content ul li.prio_0').show();
if ($(this).hasClass('notification-bubble-yellow')) $('.notification-content ul li.prio_1').show();
if ($(this).hasClass('notification-bubble-red')) $('.notification-content ul li.prio_2').show();
$(this).removeClass('filtered');
} else {
//hide all of this
if ($(this).hasClass('notification-bubble-green')) $('.notification-content ul li.prio_0').hide();
if ($(this).hasClass('notification-bubble-yellow')) $('.notification-content ul li.prio_1').hide();
if ($(this).hasClass('notification-bubble-red')) $('.notification-content ul li.prio_2').hide();
$(this).addClass('filtered');
}
});
//Periodic Update of Notifications
window.setTimeout(notification_update, 1000*60*5);
}
})
/* User clock */
function user_clock(){
var mydate = mymoment.format(user_clock_format);
$('.user_time').html(mydate);
mymoment.add(1, 's');
window.setTimeout("user_clock()", 1000);
}
/* Some static Notification Functions */
var favicon;
function notification_favicon(red, yellow, green){
if (typeof favicon === 'undefined') return;
notification_mobile(red, yellow, green);
if (red > 0) {
favicon.badge(red, {bgColor: '#d00'});
return;
}
if (yellow > 0) {
favicon.badge(yellow, {bgColor: '#F89406'});
return;
}
if (green > 0) {
favicon.badge(green, {bgColor: '#468847'});
return;
}
favicon.reset();
}
function notification_mobile(red, yellow, green){
if (red > 0) {
$('.nav-mobile .user-avatar').addClass("mobile-notify-bubble-red");
return;
}
if (yellow > 0) {
$('.nav-mobile .user-avatar').addClass("mobile-notify-bubble-yellow");
return;
}
if (green > 0) {
$('.nav-mobile .user-avatar').addClass("mobile-notify-bubble-green");
return;
}
$('.nav-mobile .user-avatar').removeClass("mobile-notify-bubble-red mobile-notify-bubble-yellow mobile-notify-bubble-green");
}
function notification_show_only(name){
if (name === 'all'){
$('.notification-filter').removeClass('filtered');
$('.notification-content ul li.prio_0, .notification-content ul li.prio_1, .notification-content ul li.prio_2').show();
} else {
$('.notification-content ul li.prio_0, .notification-content ul li.prio_1, .notification-content ul li.prio_2').hide();
$('.notification-filter').addClass('filtered');
$('.'+name+'.notification-filter').removeClass('filtered');
if (name === 'notification-bubble-green') $('.notification-content ul li.prio_0').show();
if (name === 'notification-bubble-yellow') $('.notification-content ul li.prio_1').show();
if (name === 'notification-bubble-red') $('.notification-content ul li.prio_2').show();
}
}
function notification_update(){
$.get(mmocms_controller_path+"Notifications"+mmocms_seo_extension+mmocms_sid+"&load", function(data){
$('.notification-content ul').html(data);
recalculate_notification_bubbles();
});
//5 Minute
window.setTimeout("notification_update()", 1000*60*5);
}
function test_localstorage(){
try {
return ('localStorage' in window) && window[localstorage] !== null;
} catch(e) {
return false;
}
}