-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
147 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,43 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Site | ||
* @subpackage mod_random_image | ||
* @Author Marko Zabreznik | ||
* @copyright Marko Zabreznik | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL | ||
* | ||
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, | ||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
// no direct access | ||
defined('_JEXEC') or die('Restricted access'); | ||
|
||
// Include the syndicate functions only once | ||
require_once __DIR__ . '/helper.php'; | ||
require_once dirname(__FILE__).'/helper.php'; | ||
|
||
$link = $params->get('link'); | ||
|
||
$folder = modRandomImageHelper::getFolder($params); | ||
$images = modRandomImageHelper::getImages($params, $folder); | ||
$folder = modScreensaveHelper::getFolder($params); | ||
$images = modScreensaveHelper::getImages($params, $folder); | ||
|
||
if (!count($images)) { | ||
echo JText::_('MOD_RANDOM_IMAGE_NO_IMAGES'); | ||
return; | ||
} | ||
|
||
$image = modRandomImageHelper::getRandomImage($params, $images); | ||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx')); | ||
require JModuleHelper::getLayoutPath('mod_random_image', $params->get('layout', 'default')); | ||
$opacity = $params->get('opacity', 100); | ||
$delay = $params->get('delay', 5); | ||
$wait = $params->get('wait', 5); | ||
|
||
if ( !is_numeric($opacity) || $opacity<0 || $opacity > 100 ) | ||
$opacity = 100; | ||
|
||
if ( !is_numeric($delay) || $delay<0 ) | ||
$delay = 0; | ||
|
||
if ( !is_numeric($wait) || $wait<0 ) | ||
$wait = 100; | ||
|
||
JHTML::script("rot.js", "modules/mod_screensave/js/screensave.js", false); | ||
require JModuleHelper::getLayoutPath('mod_screensave'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Site | ||
* @subpackage mod_random_image | ||
* @Author Marko Zabreznik | ||
* @copyright Marko Zabreznik | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL | ||
* | ||
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, | ||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
// no direct access | ||
defined('_JEXEC') or die('Restricted access'); | ||
?> | ||
<div class="random-image<?php echo $moduleclass_sfx ?>"> | ||
<?php if ($link) : ?> | ||
<a href="<?php echo $link; ?>"> | ||
<?php endif; ?> | ||
<?php echo JHtml::_('image', $image->folder.'/'.$image->name, $image->name, array('width' => $image->width, 'height' => $image->height)); ?> | ||
<?php if ($link) : ?> | ||
</a> | ||
<?php endif; ?> | ||
</div> | ||
<script language="JavaScript"> | ||
var screensaver; | ||
window.addEvent('domready', function(){ | ||
screensaver = new ScreenSave({ | ||
images: JSON.decode('<?php echo json_encode($images); ?>'), | ||
wait: <?php echo $wait; ?>, | ||
delay: <?php echo $delay; ?>, | ||
opacity: <?php echo $opacity/100; ?>, | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
Mod ScreenSave | ||
Marko(at)Zabreznik.net | ||
2011/11/15 22:18 | ||
*/ | ||
|
||
var ScreenSave = new Class({ | ||
options: { | ||
images: [], | ||
wait: 60, | ||
delay: 5, | ||
opacity: 100, | ||
}, | ||
initialize: function(op){ | ||
this.setOptions(op); | ||
|
||
this.active = false; | ||
this.imageElement = new Element('img',{'class': 'screensaveImg', 'id': 'screensaveImg'}); | ||
this.overlayElement=new Element('div',{'class': 'screensave', 'id': 'screensave'}); | ||
this.overlayElement.adopt(this.imageElement); | ||
$(document.body).adopt(this.overlayElement); | ||
|
||
|
||
var scroolsize = document.getScrollSize(); | ||
this.overlayElement.setStyles({ | ||
'display': 'none', | ||
'height' : scroolsize.y+'px', | ||
'width': scroolsize.x+'px', | ||
'opacity': this.options.opacity, | ||
'position': 'absolute','top': '0','left': '0','z-index': '90','background': '#000' | ||
}); | ||
this.imageElement.setStyles({ 'position': 'absolute' }); | ||
|
||
this.current = this.options.images.length; | ||
|
||
this.delayTimer = $clear(this.delayTimer); | ||
this.waitTimer = this.startSS.bind(this).delay(this.options.wait*1000); | ||
$(document.body).addEvent('mousemove', function(e) { | ||
if (this.active == true) | ||
this.stopSS(); | ||
else { | ||
this.waitTimer = $clear(this.waitTimer); | ||
this.waitTimer = this.startSS.bind(this).delay(this.options.wait*1000); | ||
} | ||
}.bindWithEvent(this)); | ||
}, | ||
startSS: function () { | ||
this.active = true; | ||
this.ShowHideAvancedElements(true); | ||
this.changeImage(); | ||
var scroolsize = document.getScrollSize(); | ||
this.overlayElement.setStyles({ | ||
'display': 'block', | ||
'height' : scroolsize.y+'px', | ||
'width': scroolsize.x+'px' | ||
}); | ||
this.delayTimer = this.changeImage.bind(this).periodical(this.options.delay*1000); | ||
}, | ||
stopSS: function () { | ||
this.active = false; | ||
this.delayTimer = $clear(this.delayTimer); | ||
this.ShowHideAvancedElements(false); | ||
this.overlayElement.style.display = 'none'; | ||
}, | ||
changeImage : function () { | ||
this.current = (this.current < this.options.images.length) ? this.current+1 : 0; | ||
this.imageElement.src = this.options.images[this.current].s; | ||
this.imageElement.setStyles({ 'width': this.options.images[this.current].w, 'height': this.options.images[this.current].h }); | ||
|
||
this.imageElement.style.top = $random(getScrollTop()+20,getScrollTop()+getHeight()-this.imageElement.height-20)+'px'; | ||
this.imageElement.style.left= $random(getScrollLeft()+20,getScrollLeft()+getWidth()-this.imageElement.width-20)+'px'; | ||
}, | ||
ShowHideAvancedElements: function (visible) { | ||
$$("applet", "iframe", "select").visibility = (visible) ? "visible": "hidden"; | ||
} | ||
}); | ||
ScreenSave.implement(new Options); |