Permalink
Browse files

Convert <button> links to <a href> to function when javascript is dis…

…abled

Optimize stylesheet definitions
  • Loading branch information...
1 parent 185fa87 commit 23b4a20d31e116b11435a8a663a5833f27a8c5df @haraldpdl haraldpdl committed Nov 4, 2010
Showing with 37 additions and 31 deletions.
  1. +17 −7 catalog/admin/includes/functions/html_output.php
  2. +20 −24 catalog/admin/includes/stylesheet.css
@@ -374,21 +374,31 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$priority = 'secondary';
}
- $button = '<button id="tdb' . $button_counter . '" type="' . tep_output_string($params['type']) . '"';
+ $button = '<span class="tdbLink">';
+
+ if ( ($params['type'] == 'button') && isset($link) ) {
+ $button .= '<a id="tdb' . $button_counter . '" href="' . $link . '"';
- if ( isset($link) ) {
if ( isset($params['newwindow']) ) {
- $button .= ' onclick="window.open(\'' . $link . '\');"';
- } else {
- $button .= ' onclick="document.location.href=\'' . $link . '\';"';
+ $button .= ' target="_blank"';
}
+ } else {
+ $button .= '<button id="tdb' . $button_counter . '" type="' . tep_output_string($params['type']) . '"';
}
if ( isset($params['params']) ) {
$button .= ' ' . $params['params'];
}
- $button .= '>' . $title . '</button><script>$("#tdb' . $button_counter . '").button(';
+ $button .= '>' . $title;
+
+ if ( ($params['type'] == 'button') && isset($link) ) {
+ $button .= '</a>';
+ } else {
+ $button .= '</button>';
+ }
+
+ $button .= '</span><script type="text/javascript">$("#tdb' . $button_counter . '").button(';
$args = array();
@@ -412,7 +422,7 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$button .= '{' . implode(',', $args) . '}';
}
- $button .= ').addClass("ui-priority-' . $priority . '");</script>';
+ $button .= ').addClass("ui-priority-' . $priority . '").parent().removeClass("tdbLink");</script>';
$button_counter++;
@@ -10,30 +10,20 @@
*/
/* links */
-a:link { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; font-weight: normal; text-decoration: none; }
-a:visited { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; font-weight: normal; text-decoration: none; }
-a:active { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; font-weight: normal; text-decoration: none; }
-a:hover { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; font-weight: normal; text-decoration: underline; }
-
-a.headerLink:link { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; text-decoration: none; }
-a.headerLink:visited { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; text-decoration: none; }
-a.headerLink:active { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; text-decoration: none; }
-a.headerLink:hover { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; text-decoration: underline; }
-
-a.menuBoxHeadingLink:link { font-size: 10px; color: #616060; font-weight: bold; text-decoration: none; }
-a.menuBoxHeadingLink:visited { font-size: 10px; color: #616060; font-weight: bold; text-decoration: none; }
-a.menuBoxHeadingLink:active { font-size: 10px; color: #616060; font-weight: bold; text-decoration: none; }
-a.menuBoxHeadingLink:hover { font-size: 10px; color: #616060; font-weight: bold; text-decoration: none; }
-
-a.menuBoxContentLink:link { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #616060; font-weight: normal; text-decoration: none; }
-a.menuBoxContentLink:visited { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #616060; font-weight: normal; text-decoration: none; }
-a.menuBoxContentLink:active { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #616060; font-weight: normal; text-decoration: none; }
-a.menuBoxContentLink:hover { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #616060; font-weight: normal; text-decoration: underline; }
-
-a.splitPageLink:link { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #0000FF; font-weight: normal; text-decoration: none; }
-a.splitPageLink:visited { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #0000FF; font-weight: normal; text-decoration: none; }
-a.splitPageLink:active { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #0000FF; font-weight: normal; text-decoration: none; }
-a.splitPageLink:hover { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #0000FF; font-weight: normal; text-decoration: underline; background-color: #FFFF33; }
+a { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; font-weight: normal; text-decoration: none; }
+a:hover { text-decoration: underline; }
+
+a.headerLink { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; text-decoration: none; }
+a.headerLink:hover { text-decoration: underline; }
+
+a.menuBoxHeadingLink { font-size: 10px; color: #616060; font-weight: bold; text-decoration: none; }
+a.menuBoxHeadingLink:hover { }
+
+a.menuBoxContentLink { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #616060; font-weight: normal; text-decoration: none; }
+a.menuBoxContentLink:hover { text-decoration: underline; }
+
+a.splitPageLink { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #0000FF; font-weight: normal; text-decoration: none; }
+a.splitPageLink:hover { text-decoration: underline; background-color: #FFFF33; }
/* menu box */
.menuBoxHeading { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #616060; background-color: #ffffff; }
@@ -150,3 +140,9 @@ FORM { display: inline; }
/* Custom jQuery UI */
.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 11px; }
+
+/* buttons */
+
+.tdbLink a { }
+
+.tdbLink button { }

0 comments on commit 23b4a20

Please sign in to comment.