root/trunk/gregarius/plugins/roundedcorners.php

Revision 1777, 3.0 kB (checked in by mbonetti, 8 months ago)

do evil on Webkit, too

Line 
1<?php
2###############################################################################
3# Gregarius - A PHP based RSS aggregator.
4# Copyright (C) 2003 - 2006 Marco Bonetti
5#
6###############################################################################
7# This program is free software and open source software; you can redistribute
8# it and/or modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2 of the License,
10# or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but WITHOUT
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15# more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
20# http://www.gnu.org/licenses/gpl.html
21#
22###############################################################################
23# E-mail:      mbonetti at gmail dot com
24# Web page:    http://gregarius.net/
25#
26###############################################################################
27
28
29/// Name: Rounded Corners
30/// Author: Marco Bonetti
31/// Description: Rounded corners in some GUI elements. Enabling this plugin breaks the CSS validation.
32/// Version: 0.4
33
34/**
35 * Changelog:
36 *
37 * 0.3 Hack for a Gecko bug which did not render rounded corners properly
38 *  on large divs. https://bugzilla.mozilla.org/show_bug.cgi?id=252241 - Sameer
39 *
40 * 0.4 Be evil on WebKit browsers, too
41 */
42
43
44function __rc_CSS($dummy) {
45        $url = getPath(). RSS_PLUGINS_DIR . "/roundedcorners.php?rc-css";
46    return "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />\n";
47}
48
49if (isset($_GET['rc-css'])) {
50        $css = "
51/* bad bad bad */
52.frame,.item,h3.collapsed,table,div.content img,
53ul.navlist li,a.bookmarklet, fieldset, div#pbholder, div.ief,
54div.ief p a, #loginfo, input[type=\"submit\"] { -moz-border-radius: 5px; -webkit-border-radius:5px }
55#sidemenu li {
56        -moz-border-radius-top-left:5px;
57        -moz-border-radius-top-right:5px;
58        -webkit-border-top-left-radius:5px;
59        -webkit-border-top-right-radius:5px;
60}
61";
62
63        require_once('../core.php');
64        rss_bootstrap(false, '$Revision$' . $css,  24);
65  header('Content-Type: text/css');
66        echo $css;
67        exit();
68}
69
70/* Turn off rounded corners on the big frames because of a gecko
71rendering bug */
72function __roundedCornersCheckjs ($dummy) {
73?>
74      <script type="text/javascript">
75      <!--
76        var theMainDivsOfItems = document.getElementById("items");     
77                if (theMainDivsOfItems && (theMainDivsOfItems.offsetHeight > 29000)) {
78                        theMainDivsOfItems.style.MozBorderRadius = 0;
79                }
80           -->
81      </script>
82<?php
83   return $dummy;
84}
85
86
87
88rss_set_hook("rss.plugins.stylesheets",'__rc_CSS');
89rss_set_hook('rss.plugins.bodyend','__roundedCornersCheckjs');
90?>
Note: See TracBrowser for help on using the browser.