mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-28 17:16:41 +03:00
Implement simple button code copying
This commit is contained in:
parent
06078cc8e7
commit
01261f8c92
26
src/mibew/js/source/button_code.js
Normal file
26
src/mibew/js/source/button_code.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*!
|
||||||
|
* This file is a part of Mibew Messenger.
|
||||||
|
*
|
||||||
|
* Copyright 2005-2021 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(Mibew, $) {
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#copy-button-code').click(function(e){
|
||||||
|
$("#button-code").select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})(Mibew, jQuery);
|
@ -48,6 +48,8 @@ class ButtonCodeController extends AbstractController
|
|||||||
'errors' => array(),
|
'errors' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->getAssetManager()->attachJs('js/compiled/button_code.js');
|
||||||
|
|
||||||
$image_locales_map = $this->getImageLocalesMap(MIBEW_FS_ROOT . '/locales');
|
$image_locales_map = $this->getImageLocalesMap(MIBEW_FS_ROOT . '/locales');
|
||||||
$image = $request->query->get('i', 'mibew');
|
$image = $request->query->get('i', 'mibew');
|
||||||
if (!isset($image_locales_map[$image])) {
|
if (!isset($image_locales_map[$image])) {
|
||||||
|
@ -145,6 +145,7 @@
|
|||||||
<textarea id="button-code" cols="44" rows="15">{{buttonCode}}</textarea>
|
<textarea id="button-code" cols="44" rows="15">{{buttonCode}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<label for="button-code" class="field-description">{{l10n "<strong>Caution!</strong> Please don't change<br/> the code manually because<br/> we don't guarantee that<br/> it will work!"}}</label>
|
<label for="button-code" class="field-description">{{l10n "<strong>Caution!</strong> Please don't change<br/> the code manually because<br/> we don't guarantee that<br/> it will work!"}}</label>
|
||||||
|
<button id="copy-button-code">{{l10n "Copy button code"}}</button>
|
||||||
<br clear="all"/>
|
<br clear="all"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@
|
|||||||
<textarea id="button-code" cols="44" rows="15">{{buttonCode}}</textarea>
|
<textarea id="button-code" cols="44" rows="15">{{buttonCode}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<label for="button-code" class="field-description">{{l10n "<strong>Caution!</strong> Please don't change<br/> the code manually because<br/> we don't guarantee that<br/> it will work!"}}</label>
|
<label for="button-code" class="field-description">{{l10n "<strong>Caution!</strong> Please don't change<br/> the code manually because<br/> we don't guarantee that<br/> it will work!"}}</label>
|
||||||
|
<button id="copy-button-code">{{l10n "Copy button code"}}</button>
|
||||||
<br clear="all"/>
|
<br clear="all"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user