Plugin Directory

Changeset 2017322


Ignore:
Timestamp:
01/23/2019 04:39:32 AM (7 years ago)
Author:
cometchat
Message:

moved inline javascript to js file

Location:
cometchat/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cometchat/trunk/comet-admin.php

    r2015193 r2017322  
    11<?php
    22    wp_enqueue_style("ccadmin", plugin_dir_url( __FILE__ ).'css/comet-admin.css');
     3    wp_enqueue_script("comet-admin", plugin_dir_url( __FILE__ ).'js/admin.js');
    34    wp_enqueue_script("comet-admin", plugin_dir_url( __FILE__ ).'js/comet-admin.js');
    45
     
    2930                    </p>
    3031                    <p style="margin-top: 20px;">
    31                         <button type="button" class="button-primary" onclick="window.open('<?php echo $adminpanelurl; ?>');">
     32                        <button type="button" class="button-primary" onclick="cometGOPanel('<?php echo $adminpanelurl; ?>');">
    3233                            Launch Admin Panel
    3334                        </button>
  • cometchat/trunk/comet-ready.php

    r2015193 r2017322  
    11<?php
    22    wp_enqueue_style("ccadmin", plugin_dir_url( __FILE__ ).'css/comet-ready.css');
     3    wp_enqueue_script("comet-admin", plugin_dir_url( __FILE__ ).'js/admin.js');
    34?>
    45
     
    1819                <p>We have pre-enabled our Docked Layout for your convenience. </p>
    1920                <div>
    20                     <button type="submit" value = "submit" id = "save" class = "button-primary" onclick="window.open('<?php echo $adminpanelurl; ?>');">Launch Admin Panel</button>
    21                     <button type="submit" value = "submit" id = "save" class = "button-primary" onclick="window.location.reload();">Go To Settings</button>
     21                    <button type="submit" value = "submit" id = "save" class = "button-primary" onclick="cometGOPanel('<?php echo $adminpanelurl; ?>');">Launch Admin Panel</button>
     22                    <button type="submit" value = "submit" id = "save" class = "button-primary" onclick="cometGoSettings();">Go To Settings</button>
    2223                </div>
    2324            </div>
  • cometchat/trunk/js/admin.js

    r2015193 r2017322  
    1 (function($) {
     1function cometGOPanel(url) {
     2    if(typeof(url) == 'undefined') {
     3        return;
     4    }
     5    window.open(url);
     6}
    27
    3 var show_friends;
    4 var bp_group_sync;
    5 
    6 jQuery(document).ready(function() {
    7     jQuery('#save').on('click', function(e) {
    8         console.log('clicked');
    9         show_friends = jQuery("input.show_friends[type=checkbox]:checked").val();
    10         if(show_friends == '' || show_friends == undefined){
    11             show_friends = "false";
    12         }else{
    13             show_friends = "true";
    14         }
    15 
    16         bp_group_sync = jQuery("input.bp_group_sync[type=checkbox]:checked").val();
    17         if(bp_group_sync == '' || bp_group_sync == undefined){
    18             bp_group_sync = "false";
    19         }else{
    20             bp_group_sync = "true";
    21         }
    22 
    23         data = {
    24             'action': 'cc_action',
    25             'api': 'cometchat_friend_ajax',
    26             'show_friends': show_friends,
    27             'bp_group_sync': bp_group_sync
    28         }
    29 
    30         jQuery.post(ajaxurl, data, function(response){
    31             jQuery("#success").html("<div class='updated'><p>Settings successfully saved!</p></div>");
    32             jQuery(".updated").fadeOut(3000);
    33         });
    34     });
    35 });
     8function cometGoSettings() {
     9    window.location.reload();
     10}
Note: See TracChangeset for help on using the changeset viewer.