From 7222a6cf78fd91ac2c762addb9786b50dc5b4d84 Mon Sep 17 00:00:00 2001 From: Tatiana5 Date: Fri, 2 Apr 2021 07:49:12 +0300 Subject: [PATCH] Fix style and new event --- config/services.yml | 1 + controller/thanks_ajax_handler.php | 44 +- .../template/addon_for_thanks_for_posts.js | 480 +++++++++--------- 3 files changed, 285 insertions(+), 240 deletions(-) diff --git a/config/services.yml b/config/services.yml index 2bf376f..bbe0991 100644 --- a/config/services.yml +++ b/config/services.yml @@ -21,6 +21,7 @@ services: - '%core.root_path%' - '%core.php_ext%' - '@controller.helper' + - '@dispatcher' - '%tables.thanks%' - '%tables.users%' - '%tables.posts%' diff --git a/controller/thanks_ajax_handler.php b/controller/thanks_ajax_handler.php index 84baa74..9cd5f28 100644 --- a/controller/thanks_ajax_handler.php +++ b/controller/thanks_ajax_handler.php @@ -28,9 +28,13 @@ class thanks_ajax_handler /** @var string phpEx */ protected $php_ext; + /** @var \phpbb\controller\helper */ protected $controller_helper; + /** @var \phpbb\event\dispatcher_interface */ + protected $phpbb_dispatcher; + /** @var string */ protected $thanks_table; @@ -58,6 +62,7 @@ class thanks_ajax_handler * @param string $phpbb_root_path phpbb_root_path * @param string $php_ext phpEx * @param \phpbb\controller\helper $controller_helper Controller helper object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object * @param string $thanks_table ThanksForPost table name * @param string $users_table Users table name * @param string $posts_table Posts table name @@ -68,7 +73,13 @@ class thanks_ajax_handler * @access public */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\user $user, $phpbb_root_path, $php_ext, \phpbb\controller\helper $controller_helper, $thanks_table, $users_table, $posts_table, \phpbb\path_helper $path_helper, \phpbb\extension\manager $phpbb_extension_manager, \gfksx\thanksforposts\core\helper $gfksx_helper = null) + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, + \phpbb\auth\auth $auth, \phpbb\user $user, $phpbb_root_path, $php_ext, + \phpbb\controller\helper $controller_helper, + \phpbb\event\dispatcher_interface $phpbb_dispatcher, + $thanks_table, $users_table, $posts_table, + \phpbb\path_helper $path_helper, \phpbb\extension\manager $phpbb_extension_manager, + \gfksx\thanksforposts\core\helper $gfksx_helper = null) { $this->config = $config; $this->db = $db; @@ -77,6 +88,7 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->controller_helper = $controller_helper; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->thanks_table = $thanks_table; $this->users_table = $users_table; $this->posts_table = $posts_table; @@ -146,6 +158,21 @@ public function main($action, $poster, $forum, $topic, $post) private function thanks_for_post($action, $poster_id, $forum_id, $topic_id, $post_id) { $user_id = (int) $this->user->data['user_id']; + + /** + * + * + * @event alg.addonforthanksforposts.thanks_for_posts_before + * @var string action + * @var int poster_id + * @var int forum_id + * @var int topic_id + * @var int post_id + * @var int user_id + */ + $vars = ['action', 'poster_id', 'forum_id', 'topic_id', 'post_id', 'user_id']; + extract($this->phpbb_dispatcher->trigger_event('alg.addonforthanksforposts.thanks_for_posts_before', compact($vars))); + if ($this->user->data['user_type'] != USER_IGNORE && !empty($poster_id)) { switch ($action) @@ -285,6 +312,8 @@ private function thanks_for_post($action, $poster_id, $forum_id, $topic_id, $pos 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? (bool) $this->config['thanks_reput_graphic'] : false, 'THANKS_REPUT_GRAPHIC_WIDTH' => isset($this->config['thanks_reput_level']) ? (isset($this->config['thanks_reput_height']) ? sprintf('%dpx', $this->config['thanks_reput_level']*$this->config['thanks_reput_height']) : false) : false, 'THANKS_REPUT_HEIGHT' => isset($this->config['thanks_reput_height']) ? sprintf('%dpx', $this->config['thanks_reput_height']) : false, + 'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', + 'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', 'THANKS' => $thanks_list, 'THANKS_POSTLIST_VIEW' => isset($this->config['thanks_postlist_view']) ? (bool) $this->config['thanks_postlist_view'] : false, 'S_MOD_THANKS' => $this->auth->acl_get('m_thanks') ? true :false, @@ -303,6 +332,7 @@ private function thanks_for_post($action, $poster_id, $forum_id, $topic_id, $pos 'IS_ALLOW_REMOVE_THANKS' => isset($this->config['remove_thanks']) ? (bool) $this->config['remove_thanks'] : true, 'CORRETED_TEXT_BBCODE' => $this-> correctedTextHideBbcode, 'IS_CHANGE_TEXT' => $this-> b_changeText, + 'THANKS_COUNT' => $thanks_number, ); } @@ -395,12 +425,18 @@ private function get_thanks($post_id, &$count) else { $return .= $comma; - $return .= get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + $nickname = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); if (isset($this->config['thanks_time_view']) ? $this->config['thanks_time_view'] : false) { - $return .= ($row['thanks_time']) ? ' ('.$this->user->format_date($row['thanks_time'], false, ($view == 'print') ? true : false) . ')' : ''; + $return .= ($row['thanks_time']) ? '' : ''; + $return .= $nickname; + $return .= ''; + } + else + { + $return .= $nickname; } - $comma = ' • '; + $comma = ', '; } $count++; } diff --git a/styles/prosilver/template/addon_for_thanks_for_posts.js b/styles/prosilver/template/addon_for_thanks_for_posts.js index db35b03..0e5d598 100644 --- a/styles/prosilver/template/addon_for_thanks_for_posts.js +++ b/styles/prosilver/template/addon_for_thanks_for_posts.js @@ -1,215 +1,223 @@ (function ($, document) { // Avoid conflicts with other libraries - function add_ajax_thanks(e, elements) { - var btnsLike =$('i.icon').filter(function (index, item) { - return $(this).is('.fa-thumbs-o-up,.fa-thumbs-o-down'); - }); - let lnk_thanks_posts = document.querySelectorAll('*[id^="lnk_thanks_post"]'); - // $(btnsLike).on('click', function (e) { - $(lnk_thanks_posts).on('click', function (e) { - e.preventDefault(); - if ($(this).hasClass("disabled")) { - return false; - } - //set all thanks button disabled - // $(btnsLike).addClass("disabled"); - $(lnk_thanks_posts).addClass("disabled"); - var action = $(this).find('i').hasClass("fa-thumbs-o-up") ? 'thanks' : 'rthanks'; - var post_block = $(this).parents('div.post'); - var post_id; - if ($(post_block).attr("id") == 'post-article') { - post_id = $(post_block).prev().attr('id').replace(/p/g, ''); - } else { - post_id = $(post_block).attr('id').replace(/p/g, ''); - } - var url = $('#lnk_thanks_post' + post_id).attr('href'); - var poster_id = $.urlParam('to_id', url); - // console.log('url = ' + url); - // console.log('poster_id = ' + poster_id); - // console.log('U_ADDONFORTHANKSFORPOSTS_PATH = ' + U_ADDONFORTHANKSFORPOSTS_PATH); - //patch remove sid - U_ADDONFORTHANKSFORPOSTS_PATH = U_ADDONFORTHANKSFORPOSTS_PATH.split("/?sid")[0]; - var path = U_ADDONFORTHANKSFORPOSTS_PATH + action + '/' + poster_id + '/' + forum_id + '/' + topic_id + '/' + post_id; - console.log("path = " + path); - $.ajax({ - type: 'POST', - dataType: 'json', - cache: false, - url: path, - success: function (data) { - togle_thanks(data); - } - }); - }); - - $("div.postbody").on('click', 'a[id^="clear_list_thanks"]', function (e) { - e.preventDefault(); - var post_id = $(this).attr('id').replace(/clear_list_thanks/g, ''); - var url = $('#lnk_thanks_post' + post_id).attr('href'); - var poster_id = $.urlParam('to_id', url);// - var n = noty({ - text: LA_CLEAR_LIST_THANKS_CONFIRM, - type: 'notification', - dismissQueue: false, - layout: 'topCenter', - timeout: false, // delay for closing event. Set false for sticky notifications - modal: true, - closeWith: ['button'], // ['click', 'button', 'hover'] - - theme: 'defaultTheme', - buttons: [{ - addClass: 'btn btn-primary', text: LA_YES, onClick: function ($noty) { - var path = U_ADDONFORTHANKSFORPOSTS_PATH + 'clear_thanks/' + poster_id + '/' + $("input[name='forum_id']").val() + '/' + $("input[name='topic_id']").val() + '/' + post_id; - $.ajax({ - type: 'POST', - dataType: 'json', - url: path, - success: function (data) { - list_thanks_for_post_cleared(data); - } - }); - $noty.close(); - } - }, - { - addClass: 'btn btn-danger', text: LA_NO, onClick: function ($noty) { - $noty.close(); - } - }] - }); - }); - } - - $(document).ready(function (e) { - add_ajax_thanks(e, $(document)); - }); - $('#qr_posts').on('qr_loaded', add_ajax_thanks); - - function togle_thanks(data) { + var thanks_icon_add = 'fa-thumbs-o-up', + thanks_icon_remove = 'fa-thumbs-o-down', + thanks_icons = '.fa-thumbs-o-up,.fa-thumbs-o-down'; + + function add_ajax_thanks(e, elements) { + var btnsLike =$('i.icon').filter(function (index, item) { + return $(this).is(thanks_icons); + }); + let lnk_thanks_posts = document.querySelectorAll('*[id^="lnk_thanks_post"]'); + // $(btnsLike).on('click', function (e) { + $(lnk_thanks_posts).on('click', function (e) { + e.preventDefault(); + if ($(this).hasClass("disabled")) { + return false; + } + //set all thanks button disabled + // $(btnsLike).addClass("disabled"); + $(lnk_thanks_posts).addClass("disabled"); + var action = $(this).find('i').hasClass(thanks_icon_add) ? 'thanks' : 'rthanks'; + var post_block = $(this).parents('div.post'); + var post_id; + if ($(post_block).attr("id") == 'post-article') { + post_id = $(post_block).prev().attr('id').replace(/p/g, ''); + } else { + post_id = $(post_block).attr('id').replace(/p/g, ''); + } + var url = $('#lnk_thanks_post' + post_id).attr('href'); + var poster_id = $.urlParam('to_id', url); + // console.log('url = ' + url); + // console.log('poster_id = ' + poster_id); + // console.log('U_ADDONFORTHANKSFORPOSTS_PATH = ' + U_ADDONFORTHANKSFORPOSTS_PATH); + //patch remove sid + U_ADDONFORTHANKSFORPOSTS_PATH = U_ADDONFORTHANKSFORPOSTS_PATH.split("/?sid")[0]; + var path = U_ADDONFORTHANKSFORPOSTS_PATH + action + '/' + poster_id + '/' + forum_id + '/' + topic_id + '/' + post_id; + console.log("path = " + path); + $.ajax({ + type: 'POST', + dataType: 'json', + cache: false, + url: path, + success: function (data) { + togle_thanks(data); + } + }); + }); + + $("div.postbody").on('click', 'a[id^="clear_list_thanks"]', function (e) { + e.preventDefault(); + var post_id = $(this).attr('id').replace(/clear_list_thanks/g, ''); + var url = $('#lnk_thanks_post' + post_id).attr('href'); + var poster_id = $.urlParam('to_id', url);// + var n = noty({ + text: LA_CLEAR_LIST_THANKS_CONFIRM, + type: 'notification', + dismissQueue: false, + layout: 'topCenter', + timeout: false, // delay for closing event. Set false for sticky notifications + modal: true, + closeWith: ['button'], // ['click', 'button', 'hover'] + + theme: 'defaultTheme', + buttons: [{ + addClass: 'btn btn-primary', text: LA_YES, onClick: function ($noty) { + var path = U_ADDONFORTHANKSFORPOSTS_PATH + 'clear_thanks/' + poster_id + '/' + $("input[name='forum_id']").val() + '/' + $("input[name='topic_id']").val() + '/' + post_id; + $.ajax({ + type: 'POST', + dataType: 'json', + url: path, + success: function (data) { + list_thanks_for_post_cleared(data); + } + }); + $noty.close(); + } + }, + { + addClass: 'btn btn-danger', text: LA_NO, onClick: function ($noty) { + $noty.close(); + } + }] + }); + }); + } + + $(document).ready(function (e) { + add_ajax_thanks(e, $(document)); + }); + $('#qr_posts').on('qr_loaded', add_ajax_thanks); + + function togle_thanks(data) { var btnsLike =$('i.icon').filter(function (index, item) { - return $(this).is('.fa-thumbs-o-up,.fa-thumbs-o-down'); - }); - let lnk_thanks_posts = document.querySelectorAll('*[id^="lnk_thanks_post"]'); - // console.log(lnk_thanks_posts); - //set all thanks button enabled - // $(btnsLike).removeClass("disabled"); - $(lnk_thanks_posts).removeClass("disabled"); - if (data['ERROR']) { - for (i = 0; i < data['ERROR'].length; i++) { - output_info_new(data['ERROR'][i], 'error'); - } - return; - } - output_info_new(data['SUCCESS'], 'warning'); - - //update icon and tooltip - if (data.IS_ALLOW_REMOVE_THANKS) { - - $("#lnk_thanks_post" + data.POST_ID).attr('title', data.THANK_ALT).attr('href', data.THANK_PATH.replace(/&/g, '&')); - $("#lnk_thanks_post" + data.POST_ID).find('i').removeClass("fa-thumbs-o-up").removeClass("fa-thumbs-o-down").addClass(data.CLASS_ICON); - - //patch for quick links - $(".clone-first a#lnk_thanks_post" + data.POST_ID).attr('title', data.THANK_ALT).attr('href', data.THANK_PATH.replace(/&/g, '&')); - $(".clone-first a#lnk_thanks_post" + data.POST_ID).find('span').html(data.THANK_ALT_SHORT); - $(".clone-first a#lnk_thanks_post" + data.POST_ID).find('i').removeClass("fa-thumbs-o-up").removeClass("fa-thumbs-o-down").addClass(data.CLASS_ICON); - } - else - { - $("#lnk_thanks_post" + data.POST_ID).parent().hide(); - //patch for quick links - $(".clone-first a#lnk_thanks_post" + data.POST_ID).parent().hide(); - } - //update reput list - if (data.THANKS && data.THANKS_POSTLIST_VIEW) { - var updDiv = "
"; - updDiv = updDiv + "
"; - if (!data.S_POST_ANONYMOUS && !data.S_IS_BOT && data.S_MOD_THANKS) { - updDiv = updDiv + ""; - } - if (!data.S_POST_ANONYMOUS && !data.S_IS_BOT) { - updDiv = updDiv + "
" + data.THANK_TEXT + data.POST_AUTHOR_FULL + data.THANK_TEXT_2 + "
"; - updDiv = updDiv + "
" + data.THANKS + "
"; - } - updDiv = updDiv + "
"; - updDiv = updDiv + "
"; - - $('#list_thanks' + data.POST_ID).html(updDiv); - } else { - $('#list_thanks' + data.POST_ID).html(''); - } - - //update reput graphic - if (data.S_THANKS_POST_REPUT_VIEW && data.POST_REPUT && !data.S_POST_ANONYMOUS && !data.S_IS_BOT) { - var updDiv = ''; - updDiv = updDiv + "
"; - updDiv = updDiv + "
"; - updDiv = updDiv + "
" + LA_REPUT + ": " + data.POST_REPUT + "
"; - updDiv = updDiv + "
"; - if (data.S_THANKS_REPUT_GRAPHIC) { - updDiv = updDiv + "
"; - updDiv = updDiv + "
 "; - } - updDiv = updDiv + "
"; - $('#div_post_reput' + data.POST_ID).html(updDiv); - } else { - $('#div_post_reput' + data['POST_ID']).html(''); - } - //update profile - update_profile(data) + return $(this).is(thanks_icons); + }); + let lnk_thanks_posts = document.querySelectorAll('*[id^="lnk_thanks_post"]'); + // console.log(lnk_thanks_posts); + //set all thanks button enabled + // $(btnsLike).removeClass("disabled"); + $(lnk_thanks_posts).removeClass("disabled"); + if (data['ERROR']) { + for (i = 0; i < data['ERROR'].length; i++) { + output_info_new(data['ERROR'][i], 'error'); + } + return; + } + output_info_new(data['SUCCESS'], 'warning'); + + //update icon and tooltip + data.CLASS_ICON = (data.CLASS_ICON == 'fa-thumbs-o-up') ? thanks_icon_add : thanks_icon_remove; + + if (data.IS_ALLOW_REMOVE_THANKS) { + + $("#lnk_thanks_post" + data.POST_ID).attr('title', data.THANK_ALT).attr('href', data.THANK_PATH.replace(/&/g, '&')); + $("#lnk_thanks_post" + data.POST_ID).find('i').removeClass(thanks_icon_add).removeClass(thanks_icon_remove).addClass(data.CLASS_ICON); + + //patch for quick links + $(".clone-first a#lnk_thanks_post" + data.POST_ID).attr('title', data.THANK_ALT).attr('href', data.THANK_PATH.replace(/&/g, '&')); + $(".clone-first a#lnk_thanks_post" + data.POST_ID).find('span').html(data.THANK_ALT_SHORT); + $(".clone-first a#lnk_thanks_post" + data.POST_ID).find('i').removeClass(thanks_icon_add).removeClass(thanks_icon_remove).addClass(data.CLASS_ICON); + } + else + { + $("#lnk_thanks_post" + data.POST_ID).parent().hide(); + //patch for quick links + $(".clone-first a#lnk_thanks_post" + data.POST_ID).parent().hide(); + } + //update reput list + if (data.THANKS && data.THANKS_POSTLIST_VIEW) { + var updDiv = "
"; + updDiv = updDiv + "
"; + if (!data.S_POST_ANONYMOUS && !data.S_IS_BOT && data.S_MOD_THANKS) { + updDiv = updDiv + ""; + } + if (!data.S_POST_ANONYMOUS && !data.S_IS_BOT) { + updDiv = updDiv + "
" + data.THANK_TEXT + data.POST_AUTHOR_FULL + data.THANK_TEXT_2 + "
"; + updDiv = updDiv + "
" + data.THANKS + "
"; + } + updDiv = updDiv + "
"; + updDiv = updDiv + "
"; + + $('#list_thanks' + data.POST_ID).html(updDiv); + } else { + $('#list_thanks' + data.POST_ID).html(''); + } + + //update reput graphic + if (data.S_THANKS_POST_REPUT_VIEW && data.POST_REPUT && !data.S_POST_ANONYMOUS && !data.S_IS_BOT) { + var updDiv = ''; + updDiv = updDiv + "
"; + updDiv = updDiv + "
"; + updDiv = updDiv + "
" + LA_REPUT + ": " + data.POST_REPUT + "
"; + updDiv = updDiv + "
"; + if (data.S_THANKS_REPUT_GRAPHIC) { + updDiv = updDiv + ""; + updDiv = updDiv + " "; + } + updDiv = updDiv + "
"; + $('#div_post_reput' + data.POST_ID).html(updDiv); + } else { + $('#div_post_reput' + data['POST_ID']).html(''); + } + //update profile + update_profile(data) //update text with [hide]BBCODE - update_text(data) - } - - function list_thanks_for_post_cleared(data) { - if (data['ERROR']) { - for (i = 0; i < data['ERROR_COUNT']; i++) { - output_info_new(data['ERROR'][i], 'error'); - } - return; - } - output_info_new(data['SUCCESS'], 'warning'); - //clear list and reput - $('#div_post_reput' + data['POST_ID']).html(''); - $('#list_thanks' + data['POST_ID']).html(''); - - //update thanks img - $("#lnk_thanks_post" + data.POST_ID).attr('title', data.THANK_ALT).attr('href', data.THANK_PATH.replace(/&/g, '&')); - $("#lnk_thanks_post" + data.POST_ID).find('i').removeClass("fa-thumbs-o-up").removeClass("fa-thumbs-o-down").addClass(data.CLASS_ICON); - - //update profile - update_profile(data) - } - - function update_profile(data) { - if (!data.S_POST_ANONYMOUS && data.THANKS_COUNTERS_VIEW) { - $("dd[data-user-receive-id= " + data['POSTER_ID'] + "]").each(function () { - var rcv = ''; - if (data.POSTER_RECEIVE_COUNT == 0) { - $(this).html(''); - } + update_text(data) + } + + function list_thanks_for_post_cleared(data) { + data.CLASS_ICON = (data.CLASS_ICON == 'fa-thumbs-o-up') ? thanks_icon_add : thanks_icon_remove; + + if (data['ERROR']) { + for (i = 0; i < data['ERROR_COUNT']; i++) { + output_info_new(data['ERROR'][i], 'error'); + } + return; + } + output_info_new(data['SUCCESS'], 'warning'); + //clear list and reput + $('#div_post_reput' + data['POST_ID']).html(''); + $('#list_thanks' + data['POST_ID']).html(''); + + //update thanks img + $("#lnk_thanks_post" + data.POST_ID).attr('title', data.THANK_ALT).attr('href', data.THANK_PATH.replace(/&/g, '&')); + $("#lnk_thanks_post" + data.POST_ID).find('i').removeClass(thanks_icon_add).removeClass(thanks_icon_remove).addClass(data.CLASS_ICON); + + //update profile + update_profile(data) + } + + function update_profile(data) { + if (!data.S_POST_ANONYMOUS && data.THANKS_COUNTERS_VIEW) { + $("dd[data-user-receive-id= " + data['POSTER_ID'] + "]").each(function () { + var rcv = ''; + if (data.POSTER_RECEIVE_COUNT == 0) { + $(this).html(''); + } else { rcv = "" + LA_RECEIVED + ": " + data.POSTER_RECEIVE_COUNT + ""; $(this).html(rcv); - } - }); - - $("dd[data-user-give-id= " + data['USER_ID'] + "]").each(function () { - var give = ''; - if (data.POSTER_GIVE_COUNT == 0) { - $(this).html(''); - } else { - give = "" + LA_GIVEN + ": " + data.POSTER_GIVE_COUNT + ""; - $(this).html(give); - } - }); - } - } + } + }); + + $("dd[data-user-give-id= " + data['USER_ID'] + "]").each(function () { + var give = ''; + if (data.POSTER_GIVE_COUNT == 0) { + $(this).html(''); + } else { + give = "" + LA_GIVEN + ": " + data.POSTER_GIVE_COUNT + ""; + $(this).html(give); + } + }); + } + } function update_text(data) { if (data.IS_CHANGE_TEXT && data.CORRETED_TEXT_BBCODE != '') @@ -222,34 +230,34 @@ } } - //creates a new jQuery UI notification message - function output_info_new(message, type, expire, is_reload) { - if (type == null) - type = 'notification'; - if (expire == null) - expire = 4000; - var n = noty({ - text: message, - type: type, - timeout: expire, - layout: 'topRight', - theme: 'defaultTheme', - callback: { - afterClose: function () { - if (is_reload == null || is_reload == '' || is_reload != true) - return; - window.location.reload(); - } - } - }); - } - - $.urlParam = function (name, url) { - var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(url); - if (results == null) { - return null; - } else { - return results[1] || 0; - } - } -})(jQuery, document); // Avoid conflicts with other libraries + //creates a new jQuery UI notification message + function output_info_new(message, type, expire, is_reload) { + if (type == null) + type = 'notification'; + if (expire == null) + expire = 4000; + var n = noty({ + text: message, + type: type, + timeout: expire, + layout: 'topRight', + theme: 'defaultTheme', + callback: { + afterClose: function () { + if (is_reload == null || is_reload == '' || is_reload != true) + return; + window.location.reload(); + } + } + }); + } + + $.urlParam = function (name, url) { + var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(url); + if (results == null) { + return null; + } else { + return results[1] || 0; + } + } +})(jQuery, document); // Avoid conflicts with other libraries