Skip to content

Commit

Permalink
Merge pull request #6 from medmen/colors
Browse files Browse the repository at this point in the history
fixing issue #4
  • Loading branch information
medmen committed Jan 8, 2019
2 parents a2ec559 + fa20211 commit adcefe8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
$conf['width'] = '90%';
$conf['height'] = '2.5em';
$conf['textcolor'] = 'red';
$conf['bgcolor'] = 'transparent';
3 changes: 2 additions & 1 deletion conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
$meta['border-radius'] = array('string');
$meta['width'] = array('string');
$meta['height'] = array('string');
$meta['textcolor'] = array('string');
$meta['textcolor'] = array('string');
$meta['bgcolor'] = array('string');
5 changes: 3 additions & 2 deletions lang/de/settings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* english language file for scrollticker plugin
* german language file for scrollticker plugin
*
* @author Michael Bohn <mjbohn@gmail.com>
*
Expand All @@ -15,4 +15,5 @@
$lang['border-radius'] = 'abgerundete Ecken am Rand? ( Radius oder 0 für keine )';
$lang['width'] = 'Ticker Breite (%)';
$lang['height'] = 'Ticker Höhe (Standard: 2em)';
$lang['textcolor'] = 'Farbe des Ticker-Inhalts';
$lang['textcolor'] = 'Farbe des Ticker-Inhalts';
$lang['bgcolor'] = 'Farbe des Hintergrunds';
3 changes: 2 additions & 1 deletion lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
$lang['border-radius'] = 'Add rounded corners ( 0 for none )';
$lang['width'] = 'Ticker width (%)';
$lang['height'] = 'Ticker height (default 2em)';
$lang['textcolor'] = 'Color of ticker text';
$lang['textcolor'] = 'Color of ticker text';
$lang['bgcolor'] = 'Color of background';
38 changes: 24 additions & 14 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,43 @@ jQuery.fn.liScroll = function(settings) {
settings = jQuery.extend({
travelocity: JSINFO['plugin_scrollticker']['speed'] / 100
}, settings);

return this.each(function(){
var $strip = jQuery(this);
$strip.addClass("newsticker");
$strip.addClass("newsticker"); // each ul inside <scrollticker> gets class added
var stripWidth = 1;
var separator = JSINFO['plugin_scrollticker']['separator'];
separator = separator.replace(/\s/g, '\xa0');
separator = separator.replace(/\s/g, '\xa0'); //make spaces safe

$strip.find("li").each(function(i){
$strip.find("li").each(function(i){ //iterate through every <li>
var liTxt = jQuery( this ).html();
if(i < $strip.find("li").length -1) {
jQuery(this).html(liTxt + separator);
jQuery(this).html(liTxt + separator); // add separator between items
}
else{
jQuery(this).html(liTxt );
}
stripWidth += jQuery(this, i).outerWidth(true); // thanks to Michael Haszprunar and Fabien Volpi

// add counter if desired
jQuery( this ).addClass("counter_" + JSINFO['plugin_scrollticker']['counterstyle']);

//sum up width of ticker items including separator
stripWidth += jQuery(this, i).outerWidth(true); // thanks to Michael Haszprunar and Fabien Volpi
});

var $mask = $strip.wrap("<div class='mask'></div>");
var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");
var containerWidth = $strip.parent().parent().width(); //a.k.a. 'mask' width

// enlarge strip to fit counter
if(JSINFO['plugin_scrollticker']['counterstyle'] != 'none')
{
stripWidth += 21 * $strip.find('li').length;
stripWidth += 21 * $strip.find('li').length; // why the hell 21 ??
}

var $mask = $strip.wrap("<div class='mask'></div>");
var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");
var containerWidth = $strip.parent().parent().width(); //a.k.a. 'mask' width

$strip.width(stripWidth);

var totalTravel = stripWidth+containerWidth;
var defTiming = totalTravel/settings.travelocity; // thanks to Scott Waye
function scrollnews(spazio, tempo){
Expand All @@ -77,14 +83,18 @@ jQuery(function(){
jQuery("div.ui-newsticker ul").liScroll({

});
var $ticker = jQuery(".tickercontainer");

jQuery(".tickercontainer").css("border-radius",JSINFO['plugin_scrollticker']['border-radius']);
$ticker.css("border-radius",JSINFO['plugin_scrollticker']['border-radius']);

if(JSINFO['plugin_scrollticker']['showBorder']){
jQuery(".tickercontainer").css("border",JSINFO['plugin_scrollticker']['border']);
$ticker.css("border",JSINFO['plugin_scrollticker']['border']);
}

jQuery(".tickercontainer").css("width",JSINFO['plugin_scrollticker']['width']);
jQuery(".tickercontainer").css("height",JSINFO['plugin_scrollticker']['height']);
jQuery(".tickercontainer").css("color",JSINFO['plugin_scrollticker']['textcolor']);
$ticker.css("width",JSINFO['plugin_scrollticker']['width']);
$ticker.css("height",JSINFO['plugin_scrollticker']['height']);
$ticker.css("color",JSINFO['plugin_scrollticker']['textcolor']);
jQuery(".tickercontainer ul li").css("color",JSINFO['plugin_scrollticker']['textcolor']);
$ticker.css("background-color",JSINFO['plugin_scrollticker']['bgcolor']);
jQuery(".tickercontainer ul li").css("background-color","transparent");
});

0 comments on commit adcefe8

Please sign in to comment.