mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix compatibility with communication module skins that don't support window_type=self
This commit is contained in:
parent
42d09bde65
commit
e6dd1b2bb6
2 changed files with 40 additions and 0 deletions
|
|
@ -302,6 +302,12 @@ class communicationView extends communication
|
|||
$editor = $editor . "\n" . '<input type="hidden" name="temp_srl" value="" />' . "\n";
|
||||
Context::set('editor', $editor);
|
||||
$this->setTemplateFile('send_message');
|
||||
|
||||
// Fix for skins that don't support window_type=self
|
||||
if(Context::get('window_type') === 'self')
|
||||
{
|
||||
Context::loadFile([$this->module_path . 'tpl/js/window_type.js', 'body']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -438,6 +444,12 @@ class communicationView extends communication
|
|||
Context::set('friend_group_list', $friend_group_list);
|
||||
|
||||
$this->setTemplateFile('add_friend');
|
||||
|
||||
// Fix for skins that don't support window_type=self
|
||||
if(Context::get('window_type') === 'self')
|
||||
{
|
||||
Context::loadFile([$this->module_path . 'tpl/js/window_type.js', 'body']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -495,6 +507,12 @@ class communicationView extends communication
|
|||
}
|
||||
|
||||
$this->setTemplateFile('add_friend_group');
|
||||
|
||||
// Fix for skins that don't support window_type=self
|
||||
if(Context::get('window_type') === 'self')
|
||||
{
|
||||
Context::loadFile([$this->module_path . 'tpl/js/window_type.js', 'body']);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file communication.view.php */
|
||||
|
|
|
|||
22
modules/communication/tpl/js/window_type.js
Normal file
22
modules/communication/tpl/js/window_type.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
(function($) {
|
||||
$(function() {
|
||||
|
||||
// Find forms that submit to the Communication module.
|
||||
const regexp = /^procCommunication(SendMessage|AddFriend(Group?))$/;
|
||||
const forms = $('form').filter(function() {
|
||||
return String($(this).find('input[name=act]').val()).match(regexp);
|
||||
});
|
||||
|
||||
// Add window_type=self to each form.
|
||||
forms.each(function() {
|
||||
if ($(this).find('input[name=window_type]').length) {
|
||||
return;
|
||||
}
|
||||
const hiddenInput = $('<input type="hidden" name="window_type" value="self" />')
|
||||
hiddenInput.insertAfter($(this).find('input[name=act]'));
|
||||
});
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
Loading…
Add table
Add a link
Reference in a new issue