From bcea9d64ebf4b0cc2c80209b7669e3e7e954c4c8 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Fri, 26 Jun 2015 13:35:15 +0200
Subject: [PATCH] removed no longer needed ajax action components

---
 lib/plugins/styling/action.php | 48 ----------------------------------
 lib/plugins/styling/script.js  |  8 ++----
 2 files changed, 2 insertions(+), 54 deletions(-)

diff --git a/lib/plugins/styling/action.php b/lib/plugins/styling/action.php
index 622c634d6..896e14bef 100644
--- a/lib/plugins/styling/action.php
+++ b/lib/plugins/styling/action.php
@@ -26,8 +26,6 @@ class action_plugin_styling extends DokuWiki_Action_Plugin {
      * @return void
      */
     public function register(Doku_Event_Handler $controller) {
-        $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax');
-        $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_action');
         $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_header');
     }
 
@@ -57,52 +55,6 @@ class action_plugin_styling extends DokuWiki_Action_Plugin {
         }
     }
 
-    /**
-     * Updates the style.ini settings by passing it on to handle() of the admin component
-     *
-     * @param Doku_Event $event  event object by reference
-     * @param mixed      $param  [the parameters passed as fifth argument to register_hook() when this
-     *                           handler was registered]
-     * @return void
-     */
-    public function handle_action(Doku_Event &$event, $param) {
-        if($event->data != 'styling_plugin') return;
-        if(!auth_isadmin()) return;
-        $event->data = 'show';
-
-        /** @var admin_plugin_styling $hlp */
-        $hlp = plugin_load('admin', 'styling');
-        $hlp->handle();
-    }
-
-    /**
-     * Create the style form in the floating Dialog
-     *
-     * @param Doku_Event $event  event object by reference
-     * @param mixed      $param  [the parameters passed as fifth argument to register_hook() when this
-     *                           handler was registered]
-     * @return void
-     */
-
-    public function handle_ajax(Doku_Event &$event, $param) {
-        if($event->data != 'plugin_styling') return;
-        if(!auth_isadmin()) return;
-        $event->preventDefault();
-        $event->stopPropagation();
-
-        global $ID;
-        global $INPUT;
-        $ID = getID();
-
-        /** @var admin_plugin_styling $hlp */
-        $hlp = plugin_load('admin', 'styling');
-        if($INPUT->str('run') == 'preview') {
-            $hlp->run_preview();
-        } else {
-            $hlp->form(true);
-        }
-    }
-
 }
 
 // vim:ts=4:sw=4:et:
diff --git a/lib/plugins/styling/script.js b/lib/plugins/styling/script.js
index f732c0524..409148471 100644
--- a/lib/plugins/styling/script.js
+++ b/lib/plugins/styling/script.js
@@ -5,6 +5,8 @@ jQuery(function () {
     var $styling_plugin = jQuery('#plugin__styling');
     if (!$styling_plugin.length) return;
 
+    // add the color picker
+    $styling_plugin.find('.color').iris({});
 
     if (!$styling_plugin.hasClass('ispopup')) {
         var $hl = $styling_plugin.find('h1').first();
@@ -18,9 +20,6 @@ jQuery(function () {
         return;
     }
 
-    // add the color picker
-    $styling_plugin.find('.color').iris({});
-
     // append the loader screen
     $loader = window.opener.jQuery('#plugin__styling_loader');
     if (!$loader.length) {
@@ -45,8 +44,5 @@ jQuery(function () {
     // load preview in main window
     var now = new Date().getTime();
     var $style = window.opener.jQuery('link[rel=stylesheet][href*="lib/exe/css.php"]');
-    $style.attr('href', '');
     $style.attr('href', DOKU_BASE + 'lib/exe/css.php?preview=1&tseed=' + now);
-
-
 });
-- 
GitLab