Skip to content
Browse files

Drop another ocurence of inline js

  • Loading branch information...
1 parent 8f618e6 commit b57e186331d2f1abeff9febbf8f9933d906eb029 @nijel nijel committed Aug 8, 2011
Showing with 24 additions and 21 deletions.
  1. +16 −0 js/functions.js
  2. +7 −6 libraries/Theme.class.php
  3. +1 −15 themes.php
View
16 js/functions.js
@@ -3127,4 +3127,20 @@ $(document).ready(function() {
$('.autosubmit').change(function(e) {
e.target.form.submit();
});
+
+ /**
+ * Theme changer.
+ */
+ $('.take_theme').live('click', function(e) {
+ alert(e.target.nodeName);
+ var evt = $(e);
+ var what = evt.target.id;
+ if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
+ window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
+ window.opener.document.forms['setTheme'].submit();
+ window.close();
+ return false;
+ }
+ return true;
+ });
});
View
13 libraries/Theme.class.php
@@ -321,12 +321,13 @@ function printPreview()
{
echo '<div class="theme_preview">';
echo '<h2>' . htmlspecialchars($this->getName())
- .' (' . htmlspecialchars($this->getVersion()) . ')</h2>'
- .'<p>'
- .'<a target="_top" href="index.php'
- .PMA_generate_common_url(array('set_theme' => $this->getId())) . '"'
- .' onclick="takeThis(\'' . addslashes($this->getId()) . '\');'
- .' return false;">';
+ .' (' . htmlspecialchars($this->getVersion()) . ')</h2>';
+ echo '<p>';
+ echo '<a target="_top" class="take_theme" '
+ .'id="' . htmlspecialchars($this->getId()) . '" '
+ . 'href="index.php'.PMA_generate_common_url(array(
+ 'set_theme' => $this->getId()
+ )) . '">';
if (@file_exists($this->getPath() . '/screen.png')) {
// if screen exists then output
View
16 themes.php
@@ -19,22 +19,8 @@
/* HTML header */
$page_title = 'phpMyAdmin - ' . __('Theme');
require './libraries/header_meta_style.inc.php';
+require './libraries/header_scripts.inc.php';
?>
-<script type="text/javascript" language="javascript">
-// <![CDATA[
-function takeThis(what)
-{
- if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
- window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
- window.opener.document.forms['setTheme'].submit();
- self.close();
- } else {
- alert('<?php echo sprintf(__('No themes support; please check your configuration and/or your themes in directory %s.'), $cfg['ThemePath']); ?>');
- self.close();
- }
-}
-// ]]>
-</script>
</head>
<body id="bodythemes">

0 comments on commit b57e186

Please sign in to comment.
Something went wrong with that request. Please try again.