Plugin Directory

Changeset 2639727


Ignore:
Timestamp:
12/05/2021 08:16:04 PM (4 years ago)
Author:
weweave
Message:
  • Fixed HTML5 validation warning for <script> tag
  • Set stable tag and version to 1.7.4
Location:
wp-ajaxify-comments/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-ajaxify-comments/trunk/readme.txt

    r2450887 r2639727  
    55Requires at least: 3.1.3
    66Tested up to: 5.6
    7 Stable tag: 1.7.3
     7Stable tag: 1.7.4
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7171== Changelog ==
    7272
     73= 1.7.4 =
     74* Fixed HTML5 validation warning for <script> tag
     75
    7376= 1.7.3 =
    7477* Updated default value for "Comments container selector" to work with default theme "Twenty Twenty" without breaking compatibility to older (default) themes
     
    355358== Upgrade Notice ==
    356359
     360= 1.7.4 =
     361* Fixed HTML5 validation warning for <script> tag
     362
    357363= 1.7.3 =
    358364* Updated default value for "Comments container selector"
  • wp-ajaxify-comments/trunk/wp-ajaxify-comments.php

    r2450886 r2639727  
    66Author: weweave UG (limited liability)
    77Author URI: https://weweave.net
    8 Version: 1.7.3
     8Version: 1.7.4
    99License: GPLv2
    1010Text Domain: wpac
     
    568568}
    569569
     570function wpac_theme_has_html5_support() {
     571    $html5Support = get_theme_support('html5');
     572    return $html5Support && in_array('script', $html5Support[0]);
     573}
     574
    570575function wpac_initialize() {
    571576
     
    573578    if (!wpac_inject_scripts()) return;
    574579
    575     echo '<script type="text/javascript">/* <![CDATA[ */';
    576 
    577     echo 'if (!window["WPAC"]) var WPAC = {};';
     580    echo '<script'.(wpac_theme_has_html5_support() ? '' : ' type="text/javascript"').'>/* <![CDATA[ */';
     581
     582    echo 'if(!window["WPAC"])var WPAC={};';
    578583   
    579584    // Options
    580     echo 'WPAC._Options = {';
     585    echo 'WPAC._Options={';
    581586    $wpac_config = wpac_get_config();
    582587    foreach($wpac_config as $config) {
     
    597602
    598603    // Callbacks
    599     echo 'WPAC._Callbacks = {';
    600     echo '"beforeSelectElements": function(dom) {'.wpac_get_option('callbackOnBeforeSelectElements').'},';
    601     echo '"beforeUpdateComments": function(newDom, commentUrl) {'.wpac_get_option('callbackOnBeforeUpdateComments').'},';
    602     echo '"afterUpdateComments": function(newDom, commentUrl) {'.wpac_get_option('callbackOnAfterUpdateComments').'},';
    603     echo '"beforeSubmitComment": function() {'.wpac_get_option('callbackOnBeforeSubmitComment').'},';
    604     echo '"afterPostComment": function(commentUrl, unapproved) {'.wpac_get_option('callbackOnAfterPostComment').'}';
     604    echo 'WPAC._Callbacks={';
     605    echo '"beforeSelectElements":function(dom){'.wpac_get_option('callbackOnBeforeSelectElements').'},';
     606    echo '"beforeUpdateComments":function(newDom,commentUrl){'.wpac_get_option('callbackOnBeforeUpdateComments').'},';
     607    echo '"afterUpdateComments":function(newDom,commentUrl){'.wpac_get_option('callbackOnAfterUpdateComments').'},';
     608    echo '"beforeSubmitComment":function(){'.wpac_get_option('callbackOnBeforeSubmitComment').'},';
     609    echo '"afterPostComment":function(commentUrl,unapproved){'.wpac_get_option('callbackOnAfterPostComment').'}';
    605610    echo '};';
    606611   
     
    889894       
    890895        // Filter/remove comments and set options to load comments with secondary AJAX request
    891         echo '<script type="text/javascript">WPAC._Options["loadCommentsAsync"] = true;</script>';
     896        echo '<script'.(wpac_theme_has_html5_support() ? '' : ' type="text/javascript"').'>WPAC._Options["loadCommentsAsync"]=true;</script>';
    892897        return array();
    893898    }
Note: See TracChangeset for help on using the changeset viewer.