Skip to content

Commit

Permalink
* Use PHP to set the fore color of all tags
Browse files Browse the repository at this point in the history
* itemsPerPage value is set from INI file.
* README.md updated
  • Loading branch information
Tobias Zeising authored and Tobias Zeising committed Apr 10, 2014
1 parent 02739e0 commit 17da7cb
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 116 deletions.
7 changes: 0 additions & 7 deletions .htaccess
Expand Up @@ -4,13 +4,6 @@
RewriteEngine On
#RewriteBase /selfoss

# Force https
# following RewriteCond don't work on openshift
## RewriteCond %{HTTPS} !^on$
## RewriteCond %{HTTPS} !=on [NC]
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

# rule for favicons
RewriteRule !data/favicons/(.*)$ - [C]
RewriteRule favicons/(.*)$ data/favicons/$1 [L]
Expand Down
161 changes: 87 additions & 74 deletions README.md
Expand Up @@ -4,7 +4,7 @@ selfoss
Copyright (c) 2013 Tobias Zeising, tobias.zeising@aditu.de
http://selfoss.aditu.de
Licensed under the GPLv3 license
Version 2.10
Version 2.11-SNAPSHOT


INSTALLATION
Expand Down Expand Up @@ -50,102 +50,114 @@ Visit the page http://yourselfossurl.com/opml for importing your OPML File. If y
CHANGELOG
---------

Version 2.11-SNAPSHOT
* Little fix to Polish translation
* instapaper spout: use HTTPS
* A new spout to get full text for entries in the Teltarif RSS feed
* Fix pgsql VACUUM ANALYZE syntax error
* A new spout to get full text for entries in the Lightreading RSS feed
* Multi-language support of search and error fix.
* fix https for openshift
* Make it possible to disable auto stream more, add handy "Mark these read" button
* Use PHP to set the fore color of all tags
* itemsPerPage value is set from INI file.

Version 2.10
* fix error 500 on icon fetching
* add heise hardware-hacks (thanks a lot to robelix)
* reddit2 spout: fix link to return http (thanks a lot to Bert Deferme)
* reddit2 spout: add empty validation on username and password (thanks a lot to Bert Deferme)
* setting to lazy load images on mobile devices (thanks a lot to Bodnár István)
* update fat free php framework version 3.2.0 (thanks a lot to Tim Gerundt)
* improve heise spout (thanks a lot to robelix)
* fix duplicate items with MySQL (thanks a lot to mistic100)
* add heise hardware-hacks
* reddit2 spout: fix link to return http
* reddit2 spout: add empty validation on username and password
* setting to lazy load images on mobile devices
* update fat free php framework version 3.2.0
* improve heise spout
* fix duplicate items with MySQL
* fix auto language detection
* save OPML export file with xml extension (thanks a lot to hdhoang)
* sqlite's "optimize()" was implemented (thanks a lot to arbk)
* sources: show sources with error first (thanks a lot to hdhoang)
* save OPML export file with xml extension
* sqlite's "optimize()" was implemented
* sources: show sources with error first
* fix bug on base url determining using https
* support search terms with quotes to find exact phrase like "Windows 8" (thanks a lot to Tim Gerundt)
* github spout fix (set user agent) (thanks a lot to niol)
* more opml export logging (thanks a lot to niol)
* support search terms with quotes to find exact phrase like "Windows 8"
* github spout fix (set user agent)
* more opml export logging

Version 2.9
* new configuration parameter for share buttons (thanks a lot to becevka)
* new Ukrainian translation (thanks a lot to becevka)
* new configuration parameter for share buttons
* new Ukrainian translation
* fix Italian translation
* new error message bar (thanks a lot to tamizhgeek)
* fix php 5.5 bug for some spouts (thanks a lot to amiga23)
* fix 'Undefined Index' error in item tpl when no shares available (thanks a lot to venyii)
* add multi reddit support (thanks a lot to Janez Troha)
* avoid duplicate sources while importing OPML (thanks a lot to Azhaguselvan SP)
* prevent reflected XSS vulnerability in search form (thanks a lot to Azhaguselvan SP)
* add support for fullscreen Webapp on iPhone 5 (thanks a lot to darkside40)
* added new config parameter (unread_order) to be able to read unread items from oldest to newest (thanks a lot to Paul Fauchon)
* update twitter api (thanks a lot to bobman38)
* the processing of the parameter of the session cookie is updated (thanks a lot to arbk)
* prevent stored XSS vulnerability in the source add form (thanks a lot to Azhaguselvan SP)
* sort spouts by name (thanks a lot to Tim Gerundt)
* allow dd-element and style definition list elements (thanks a lot to mcnesium)
* new GitHub spout to list commits on a repository (thanks a lot to Tim Gerundt)
* performance improvement on feed update (thanks a lot to Brad Koehn)
* new error message bar
* fix php 5.5 bug for some spouts
* fix 'Undefined Index' error in item tpl when no shares available
* add multi reddit support
* avoid duplicate sources while importing OPML
* prevent reflected XSS vulnerability in search form
* add support for fullscreen Webapp on iPhone 5
* added new config parameter (unread_order) to be able to read unread items from oldest to newest
* update twitter api
* the processing of the parameter of the session cookie is updated
* prevent stored XSS vulnerability in the source add form
* sort spouts by name
* allow dd-element and style definition list elements
* new GitHub spout to list commits on a repository
* performance improvement on feed update

Version 2.8
* new Polish translation (thanks a lot to Piotr Dymacz)
* improved Expires section and Compression in .htaccess (thanks a lot to S Anand)
* new Polish translation
* improved Expires section and Compression in .htaccess
* make api item listing, tags and sources stats accessible for non loggedin users in public mode
* update fat free php framework version 3.0.8
* new configuration parameter for default readability api key
* new configuration parameter for allowing unauthorized access for the update job
* new delicious support (thanks a lot to bbeardsley)
* support ssl proxy (thanks a lot to zajad)
* new readability support (thanks a lot to hayk)
* pass original url to external sites except for opening the anonymized url (thanks a lot to bbeardsley)
* new finnish translation (thanks a lot to jukper)
* new spanish translation (thanks a lot to Matias Perrone)
* new delicious support
* support ssl proxy
* new readability support
* pass original url to external sites except for opening the anonymized url
* new finnish translation
* new spanish translation

Version 2.7
* new spout for instapaper (thanks a lot to janeczku)
* new Hungarian translation (thanks a lot to Sancho)
* new spout for instapaper
* new Hungarian translation
* fix keyboard shortcut on some browsers
* new spout for youtube channels (thanks a lot to Arndt Staudinger)
* new spout for youtube channels
* new rss feed for selfoss releases: http://selfoss.aditu.de/feed.php
* fix bug on removing search terms (thanks a lot to ochristi)
* translation for login page (thanks a lot to jicho)
* new japanese language file (thanks a lot to wowo)
* new shortcuts (thanks a lot to jicho)
* fix issues with refreshing the items list and slow ajax requests (thanks a lot to Sean Rand)
* don't leave behind sp-container divs when refreshing the tags (thanks a lot to Sean Rand)
* clean up orphaned items of deleted sources (thanks a lot to Sean Rand)
* fix bug on removing search terms
* translation for login page
* new japanese language file
* new shortcuts
* fix issues with refreshing the items list and slow ajax requests
* don't leave behind sp-container divs when refreshing the tags
* clean up orphaned items of deleted sources
* update fat free php framework to newest versoin 3.0.6
* only allow update for localhost or loggedin users (thanks a lot to Tiouss)
* added Facebook page feed (thanks a lot to Thomas Muguet)
* fix memory bug on icon generation (thanks a lot to Matthieu Codron)
* new opml export (thanks a lot to Sean Rand)
* new norwegian translation (thanks a lot to Kjetil Elde)
* only allow update for localhost or loggedin users
* added Facebook page feed
* fix memory bug on icon generation
* new opml export
* new norwegian translation
* set default title if no one was given by the feed

Version 2.6
* fixed OPML import for other formats (thanks a lot to Remy Gardette)
* fixed OPML import for other formats
* fix deletion of sources (no longer bad request)
* disable tag click on smartphone
* shortcuts mark/unmark as read and star/unstar also available on closed articles
* fix tag list refresh

Version 2.5
* new navigation with right/left cursor (thanks a lot to jicho)
* new navigation with right/left cursor
* replace • for IE compatibility
* fix re-initialize entry events on screen width change (thanks a lot to Sean Rand)
* allow optional userdefined user.css (thanks a lot to Jean Baptiste Favre)
* some smaller css tweaks (thanks a lot to Sean Rand)
* fix re-initialize entry events on screen width change
* allow optional userdefined user.css
* some smaller css tweaks
* new parameter use_system_font for using Arial instead of Open Sans
* new italian language file (thanks a lot to David Chionne)
* new italian language file
* fix duplicate article fetching on uids with more than 255 characters
* add integrated json api
* add error handling for feeds with wrong link
* new swedish translation (thanks a lot to andersgd)
* new swedish translation

Version 2.4
* prevent error on icons parsing error
* new homepage parameter (thanks a lot to Jean Baptiste Favre)
* new homepage parameter
* new button for open an articles source
* no error message if no unread item is available and mark all as read was pressed
* improve logger
Expand All @@ -154,15 +166,15 @@ Version 2.4
* mysql use longtext for articles content
* improved detection of mobile devices
* allow more tags in articles content
* show unread items per tag in taglist (thanks a lot to Fedor Bezrukov)
* show list of sources for filtering (thanks a lot to Fedor Bezrukov)
* show unread items per tag in taglist
* show list of sources for filtering
* use more eye catching unread stats in main navigation
* show source title in selfoss RSS feed (thanks a lot to Darkwing1)
* load sources for update by last update time (thanks a lot to Lars Formella)
* show source title in selfoss RSS feed
* load sources for update by last update time
* Opening feed search focuses the search input field
* Scroll blockquotes and pre on overflow (especially good for mobile devices)
* new option for automatically mark items as read
* new share buttons for email and pocket (thanks a lot to Francis Noel)
* new share buttons for email and pocket
* new shortcut r for reloading the current list
* new internationalization (language files for German, English, French, Turkish, Dutch, Czech, Russian, Latvian, traditional and simplified Chinese included)
* make article id generation more reliable
Expand All @@ -174,25 +186,25 @@ Version 2.4
* concurent multiples updates makes no longer duplicates entries
* Reload items on mark as read
* anonymizer support
* selfoss rss feed support tag filtering (?tag=) (thanks a lot to Francis Noel)
* selfoss rss feed support tag filtering (?tag=)
* fix tag render bug

Version 2.3
* new shortcut library jquery hotkeys (thanks a lot to Sigill)
* new shortcut for mark as read and switch to next in one step (thanks a lot to Sigill)
* new shortcut library jquery hotkeys
* new shortcut for mark as read and switch to next in one step
* prevent error on png conversion
* items will be saved in mysql databases also no icon is available
* support of PostgreSQL Database (thanks a lot to volkadav)
* now updates by command line are possible (thanks a lot to Jeppe Toustrup)
* support of PostgreSQL Database
* now updates by command line are possible
* default charset on mysql is utf8
* new readability support (thanks a lot to oxman)
* new readability support
* link to opml import added
* Use IfMoudule to avoid errors in Etags settings (thanks to vincebusam)
* Allow tag filtering to not include partial matches (thanks to WalterWeight and bsweeney)

Version 2.2
* update fat free php Framework to 3.0.5
* new opml import page (thanks a lot to Michael Moore)
* new opml import page

Version 2.1
* security bugfix
Expand Down Expand Up @@ -227,6 +239,7 @@ Version 1.1
* code optimization and smaller bugfixes



CREDITS
-------

Expand Down
2 changes: 1 addition & 1 deletion _docs/website/index.html
Expand Up @@ -255,7 +255,7 @@ <h2>Configuration</h2>
</tr>
<tr>
<td class="documentation-first-column">auto_mark_as_read</td>
<td>set this to 1 for autmatically marking items as read after open/read them.</td>
<td>set this to 1 for automatically marking items as read after open/read them.</td>
</tr>
<tr>
<td class="documentation-first-column">language</td>
Expand Down
6 changes: 4 additions & 2 deletions controllers/Index.php
Expand Up @@ -235,8 +235,10 @@ private function loadItems($options, $tags) {
*/
private function convertTagsToAssocArray($tags) {
$assocTags = array();
foreach($tags as $tag)
$assocTags[$tag['tag']] = $tag['color'];
foreach($tags as $tag) {
$assocTags[$tag['tag']]['backColor'] = $tag['color'];
$assocTags[$tag['tag']]['foreColor'] = \helpers\Color::colorByBrightness($tag['color']);
}
return $assocTags;
}
}
18 changes: 18 additions & 0 deletions helpers/Color.php
Expand Up @@ -29,4 +29,22 @@ private static function randomColorPart() {
return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
}

/**
* get dark OR bright color depending the color contrast
*
* @param string $color color (hex) value
* @param string $darkColor dark color value
* @param string $brightColor bright color value
* @return string dark OR bright color value
*
* @link http://24ways.org/2010/calculating-color-contrast/
*/
public static function colorByBrightness($color, $darkColor = '#555', $brightColor = '#EEE') {
$color = trim($color, '#');
$r = hexdec(substr($color, 0, 2));
$g = hexdec(substr($color, 2, 2));
$b = hexdec(substr($color, 4, 2));
$yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
return ($yiq >= 128) ? $darkColor : $brightColor;
}
}
1 change: 0 additions & 1 deletion index.php
Expand Up @@ -17,7 +17,6 @@
'public/js/jquery.mCustomScrollbar.min.js',
'public/js/jquery.mousewheel.js',
'public/js/lazy-image-loader.js',
'public/js/color-by-brightness.js',
'public/js/spectrum.js',
'public/js/jquery.hotkeys.js',
'public/js/selfoss-base.js',
Expand Down
22 changes: 0 additions & 22 deletions public/js/color-by-brightness.js

This file was deleted.

2 changes: 1 addition & 1 deletion public/js/selfoss-base.js
Expand Up @@ -38,7 +38,7 @@ var selfoss = {
}

// set items per page
selfoss.filter.itemsPerPage = $('.entry').length;
selfoss.filter.itemsPerPage = $('#config').data('items_perpage');

// initialize type by homepage config param
selfoss.filter.type = $('#nav-filter li.active').attr('id').replace('nav-filter-', '');
Expand Down
6 changes: 0 additions & 6 deletions public/js/selfoss-events-entries.js
Expand Up @@ -57,9 +57,6 @@ selfoss.events.entries = function(e) {
// set events for fullscreen
selfoss.events.entriesToolbar(fullscreen);

// set color of all tags by background color
fullscreen.find('.entry-tags-tag').colorByBrightness();

// set events for closing fullscreen
fullscreen.find('.entry, .entry-close').click(function(e) {
if(e.target.tagName.toLowerCase()=="a")
Expand Down Expand Up @@ -138,9 +135,6 @@ selfoss.events.entries = function(e) {
});
});

// set color of all tags by background color
$('.entry-tags-tag').colorByBrightness();

// click a tag
if(selfoss.isSmartphone()==false) {
$('.entry-tags-tag').unbind('click').click(function() {
Expand Down
3 changes: 2 additions & 1 deletion templates/home.phtml
Expand Up @@ -54,7 +54,8 @@
<span id="config"
data-anonymizer="<?PHP echo \helpers\Anonymizer::getAnonymizer(); ?>"
data-auto_mark_as_read="<?PHP echo \F3::get('auto_mark_as_read'); ?>"
data-load_images_on_mobile="<?PHP echo \F3::get('load_images_on_mobile'); ?>"></span>
data-load_images_on_mobile="<?PHP echo \F3::get('load_images_on_mobile'); ?>"
data-items_perpage="<?PHP echo \F3::get('items_perpage'); ?>" ></span>

<!-- menue open for smartphone -->
<div id="nav-mobile">
Expand Down
2 changes: 1 addition & 1 deletion templates/item.phtml
Expand Up @@ -39,7 +39,7 @@

<span class="entry-tags">
<?PHP foreach($this->item['tags'] as $tag => $color) : ?>
<span class="entry-tags-tag" style="background-color:<?PHP echo $color; ?>"><?PHP echo $tag; ?></span>
<span class="entry-tags-tag" style="color:<?PHP echo $color['foreColor']; ?>;background-color:<?PHP echo $color['backColor']; ?>"><?PHP echo $tag; ?></span>
<?PHP endforeach; ?>
</span>

Expand Down

0 comments on commit 17da7cb

Please sign in to comment.