Compare commits

...

9 Commits

5 changed files with 60 additions and 25 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
# Do not index node.js modules that are used for building
node_modules
package-lock.json
# Do not index releases
release

View File

@ -1,6 +1,6 @@
<?php
/*
* Copyright 2018 the original author or authors.
* Copyright 2018, 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.
@ -81,7 +81,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
*/
public static function getVersion()
{
return '0.0.4';
return '0.1.0';
}
/**
@ -92,7 +92,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
public function refreshButton(&$args)
{
$g = $args['asset_url_generator'];
$args['response']['load']['refresh'] = $g->generate($this->getFilesPath() . '/js/refresh.js', AssetUrlGeneratorInterface::ABSOLUTE_URL);
$args['response']['load']['refresh'] = $g->generate(str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath()) . '/js/refresh.js', AssetUrlGeneratorInterface::ABSOLUTE_URL);
$args['response']['handlers'][] = 'refreshButton';
$args['response']['dependencies']['refreshButton'] = array('refresh');
$args['response']['data']['refreshButton'] = array('mode' => $this->mode, 'submode' => $this->submode);

View File

@ -6,7 +6,7 @@ var eventStream = require('event-stream'),
gzip = require('gulp-gzip'),
rename = require('gulp-rename');
gulp.task('prepare-release', [], function() {
gulp.task('prepare-release', function() {
var version = require('./package.json').version;
return eventStream.merge(
@ -21,9 +21,7 @@ gulp.task('prepare-release', [], function() {
});
// Builds and packs plugins sources
gulp.task('default', ['prepare-release'], function() {
// The "default" task is just an alias for "prepare-release" task.
});
gulp.task('default', gulp.series('prepare-release'));
/**
* Returns files stream with the plugin sources.

View File

@ -1,9 +1,45 @@
/*!
* This file is a part of Mibew Advanced Button Plugin
*
* Copyright 2014, 2018, 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) {
Mibew.APIFunctions.refreshButton = function(data) {
// Refresh the button image
var img = document.getElementById("mibew-agent-button").getElementsByTagName("img")[0];
var originalSrc = img.src.replace(/&dummy=\d+/, '');
img.src = originalSrc + "&dummy=" + (new Date()).getTime();
var button_object;
var button = document.getElementById("mibew-agent-button");
if (!button) {
// The button is operator code field
button_object = document.getElementById("mibew-operator-code-field");
}
else {
button_object = button.getElementsByTagName("img")[0];
if (!button_object) {
// The button is text link
button_object = button;
}
else {
// The button is image, refresh it
var originalSrc = button_object.src.replace(/&dummy=\d+/, '');
button_object.src = originalSrc + "&dummy=" + (new Date()).getTime();
}
}
// Unable to find button of any type - nothing to do
if (!button_object) { return; }
// Hide the button if all popups are open or make it visible otherwise
var visible = false;
@ -15,20 +51,20 @@
// Check whether we actually need to hide the button
if (data.refreshButton.mode != 'none') {
if (data.refreshButton.mode == 'visibility') {
img.style.visibility = visible ? 'visible' : 'hidden';
button_object.style.visibility = visible ? 'visible' : 'hidden';
}
else if (data.refreshButton.mode == 'display') {
img.style.display = visible ? data.refreshButton.submode : 'none';
button_object.style.display = visible ? data.refreshButton.submode : 'none';
}
}
// Set appropriate class for the button depending on its alleged visibility
img.className = img.className.replace(/ mibew_(visible|hidden)/, '');
button_object.className = button_object.className.replace(/ mibew_(visible|hidden)/, '');
if (visible) {
img.className = img.className.concat(' mibew_visible');
button_object.className = button_object.className.concat(' mibew_visible');
}
else {
img.className = img.className.concat(' mibew_hidden');
button_object.className = button_object.className.concat(' mibew_hidden');
}
}
})(Mibew);

View File

@ -1,12 +1,12 @@
{
"version": "0.0.4",
"version": "0.1.0",
"devDependencies": {
"gulp": ">3.8.10",
"event-stream": ">3.1.7",
"gulp-zip": ">2.0.2",
"gulp-tar": ">1.3.1",
"gulp-gzip": ">0.0.8",
"gulp-chmod": ">1.2.0",
"gulp-rename": ">1.2.0"
"gulp": "~4.0.0",
"event-stream": "~3.3.4",
"gulp-zip": "~2.0.2",
"gulp-tar": "~3.1.0",
"gulp-gzip": "~0.0.8",
"gulp-chmod": "~3.0.0",
"gulp-rename": "~1.2.0"
}
}
}