The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with 3.1: Success Message with undo - from Tips & Tricks
#2
This seems to be part of the problem:
Code:
$(response).find('div.updated').html()
The javascript is not first evaluated! (look in my ajax success response)
The response is just a string, so there exists no DOM element with class "updated".

I temporarily fixed it this way in my plugin, but some core developer could think this through.

Because when you now enter the page directly via the URL you get a hidden hardcoded <div> and one from the js.

Code:
<?php
    if (isset($msg)) {
        if ($canUndo) $msg .= ' <a href="load.php?id=myplugin&undo">' . i18n_r('UNDO') . '</a>'
        ?>
        <script type="text/javascript">
        $(function() {
            $('div.bodycontent').before('<div class="<?php echo $isSuccess ? 'updated' : 'error'; ?>" style="display:block;">'+
            <?php echo json_encode($msg); ?>+'</div>');
            $(".updated, .error").fadeOut(500).fadeIn(500);
        });
        </script>
        <!-- THE DIRTY TEMPORARY FIX -->
        <div class="<?php echo $update ? 'updated' : 'error'; ?>" style="display:none;visibility:hidden;height:0;margin:0;padding:0;border:0;"><?php echo $msg; ?></div>
        <?php
    }
?>
Reply


Messages In This Thread
Problem with 3.1: Success Message with undo - from Tips & Tricks - by Petit Jean - 2012-04-26, 20:19:35



Users browsing this thread: 2 Guest(s)