Plugin Directory

Changeset 632663


Ignore:
Timestamp:
12/01/2012 12:06:27 PM (13 years ago)
Author:
ti2m
Message:

jQuery noconflict, inlineview functions

Location:
edge-suite/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • edge-suite/trunk/admin/manage.php

    r622682 r632663  
    99}
    1010
    11 if ($_POST['action'] == 'upload' && $_POST['upit'] == 'yes') {
    12   edge_suite_process_upload();
    13 }
    14 elseif ($_POST['action'] == 'delete') {
    15   edge_suite_process_delete();
     11if(isset($_POST['action'])){
     12  if ($_POST['action'] == 'upload' && isset($_POST['upit']) && $_POST['upit'] == 'yes') {
     13    edge_suite_process_upload();
     14  }
     15  elseif ($_POST['action'] == 'delete') {
     16    edge_suite_process_delete();
     17  }
    1618}
    1719
  • edge-suite/trunk/admin/options.php

    r628838 r632663  
    6969
    7070      <tr valign="top">
     71          <th scope="row">jQuery NoConflict mode (experimental)</th>
     72          <td>
     73            <?php
     74            $selected = intval(get_option('edge_suite_jquery_noconflict')) == 1 ? 'checked="checked"' : '';
     75            ?>
     76            <p><input type="checkbox" name="edge_suite_jquery_noconflict" value="1" <?php echo $selected; ?>"/>
     77                Run a separate instance of jQuery for Edge Animate.</p>
     78            <span class="setting-description">
     79                Activate this option if you experience problems with other jQuery-based JavaScript plugins.
     80                Edge Suite will initialize separate different jQuery versions.
     81            </span>
     82          </td>
     83      </tr>
     84
     85      <tr valign="top">
     86          <th scope="row">Edge Suite debug mode</th>
     87          <td>
     88            <?php
     89            $selected = intval(get_option('edge_suite_debug')) == 1 ? 'checked="checked"' : '';
     90            ?>
     91            <p><input type="checkbox" name="edge_suite_debug" value="1" <?php echo $selected; ?>"/>
     92                Run Edge Suite in debug mode</p>
     93          </td>
     94      </tr>
     95
     96      <tr valign="top">
    7197          <th scope="row">Deactivation deletion</th>
    7298          <td>
  • edge-suite/trunk/edge-suite.php

    r622682 r632663  
    9090  add_option('edge_suite_deactivation_delete', 0);
    9191  add_option('edge_suite_widget_shortcode', 0);
     92  add_option('edge_suite_jquery_noconflict', 0);
     93  add_option('edge_suite_debug', 0);
    9294
    9395  // Create main edge suite directory.
     
    117119    delete_option('edge_suite_deactivation_delete');
    118120    delete_option('edge_suite_widget_shortcode');
     121    delete_option('edge_suite_jquery_noconflict');
     122    delete_option('edge_suite_debug');
    119123  }
    120124}
     
    133137  register_setting('edge_suite_options', 'edge_suite_deactivation_delete');
    134138  register_setting('edge_suite_options', 'edge_suite_widget_shortcode');
     139  register_setting('edge_suite_options', 'edge_suite_jquery_noconflict');
     140  register_setting('edge_suite_options', 'edge_suite_debug');
    135141}
    136142
     
    197203function edge_suite_header() {
    198204  global $edge_suite;
     205  //TODO: use wp_enqueue_script()
    199206  if(isset($edge_suite->scripts) && is_array($edge_suite->scripts)){
    200207    print "\n" . implode("\n", $edge_suite->scripts) . "\n";
     
    284291 */
    285292function edge_suite_save_post_reference($id) {
    286   if (current_user_can('edge_suite_select_composition')) {
     293  if (current_user_can('edge_suite_select_composition') && isset($_POST['edge_suite_composition'])) {
    287294    $definition_id = intval($_POST['edge_suite_composition']);
    288295    if ($definition_id != 0) {
     
    367374}
    368375
     376function edge_suite_comp_view_iframe($definition_id, $css_style = ''){
     377  return edge_suite_comp_iframe($definition_id, $css_style);
     378}
     379
     380function edge_suite_comp_view_inline($definition_id, $css_style = ''){
     381
     382  $definition_res = edge_suite_comp_render($definition_id, $css_style);
     383
     384  $stage = $scripts = '';
     385
     386  if($definition_res != NULL){
     387    $scripts = implode("\n", $definition_res['scripts']);
     388    $stage = $definition_res['stage'];
     389  }
     390
     391  return "\n" . $scripts . "\n" . $stage ."\n";
     392}
     393
     394
    369395/**
    370396 * Shortcode implementation for 'edge_animation'
     
    405431  // Inline rendering
    406432  else{
    407     $definition_res = edge_suite_comp_render($definition_id, $styles);
    408 
    409     $stage = $scripts = '';
    410 
    411     if($definition_res != NULL){
    412       // Todo: Placing scripts inline in the content really isn't pretty, but so far there
    413       // doesn't seem to be an easy way around this, otherwise we need to handle shortcode
    414       // before header fuctions get called.
    415       $scripts = implode("\n", $definition_res['scripts']);
    416 
    417       $stage = $definition_res['stage'];
    418     }
    419 
    420     return "\n" . $scripts . "\n" . $stage ."\n";
     433    return edge_suite_comp_view_inline($definition_id, $styles);
    421434  }
    422435
  • edge-suite/trunk/includes/edge-suite-comp-builder.inc

    r613609 r632663  
    553553    $content = preg_replace($load_pattern, $load_replace, $content);
    554554
     555    // Search for the okToLaunchComposition function call.
     556    $launch_pattern = '/AdobeEdge\.okToLaunchComposition\(compId\)/';
     557
     558    // Replace original call with call to custom function, alters jQuery.
     559    $launch_replace = 'AdobeEdge.alterOkToLaunchComposition(compId)';
     560    $content = preg_replace($launch_pattern, $launch_replace, $content);
     561
    555562    // Find the end of the main JS function and inject to function calls to
    556563    // alter preContent and dlContent DOM, see JS function doc.
  • edge-suite/trunk/includes/edge-suite-comp.inc

    r612343 r632663  
    239239    $js_inline .= "AdobeEdge.pathPrefix.comps = AdobeEdge.pathPrefix.comps || {};";
    240240    $js_inline .= "AdobeEdge.pathPrefix.comps['" . $definition->composition_id . "'] = '" . $project_path . "';";
     241
     242    if(get_option('edge_suite_debug') == 1){
     243      $js_inline .= "AdobeEdge.edgesuiteDebug = 1;";
     244    }
     245
     246    if(get_option('edge_suite_jquery_noconflict') == 1){
     247      $js_inline .= "AdobeEdge.edgesuiteNoConflict = 1;";
     248    }
    241249
    242250    $scripts = array();
  • edge-suite/trunk/includes/edge-suite-general.php

    r622682 r632663  
    3737  //Check if dir is writable and create directory structure.
    3838  if (!mkdir_recursive(EDGE_SUITE_COMP_PROJECT_DIR)) {
    39     $msg['create_folder'] = 'Edge Suite: Unable to create directory project directory (' . EDGE_SUITE_COMP_PROJECT_DIR . '). Is its parent directory writable by the server?';
     39    $msg['create_folder'] = 'Edge Suite: Unable to create project directory (' . EDGE_SUITE_COMP_PROJECT_DIR . '). Is its parent directory writable by the server?';
    4040  }
    4141
  • edge-suite/trunk/includes/edge-wordpress.js

    r608321 r632663  
    159159  }
    160160
    161 //  for(var i in AdobeEdge.thirdPartyLibs) {
    162 //    aLoader.push({load: AdobeEdge.thirdPartyLibs[i]});
    163 //  }
     161  // Check if other jQuery version exist prior to the preloader run
     162  if(typeof jQuery != 'undefined'){
     163      if(!AdobeEdge.otherjQuery){
     164          AdobeEdge.edgesuiteLogger('Other jQuery include exists: Version ' + jQuery().jquery);
     165          if(AdobeEdge.edgesuiteNoConflict){
     166              AdobeEdge.otherjQuery = jQuery;
     167          }
     168      }
     169  }
     170  else{
     171      AdobeEdge.edgesuiteLogger('No other jQuery exists yet.');
     172  }
    164173
    165174  // Call the original loader with the modified aLoader object.
     
    167176}
    168177
     178window.jQueryEdge = window.jQueryEdge || null;
     179AdobeEdge.alterOkToLaunchComposition = function(comp){
     180    if(AdobeEdge.edgesuiteNoConflict && typeof jQueryEdge != 'undefined'){
     181        AdobeEdge.edgesuiteLogger("Init 'edgejQuery' with: Version " + jQuery().jquery);
     182        jQueryEdge = jQuery;
     183        // AdobeEdge.edgesuiteLogger('jQuery NoConflict');
     184        // jQuery.noConflict(true);
     185        if(AdobeEdge.otherjQuery){
     186            jQuery = AdobeEdge.otherjQuery;
     187            AdobeEdge.edgesuiteLogger("Reset 'jQuery' to: Version " + jQuery().jquery);
     188        }
     189    }
     190
     191    // Fire composition launch
     192    AdobeEdge.okToLaunchComposition(comp);
     193}
     194
     195AdobeEdge.edgesuiteLogger = function(msg, level){
     196    if(!level){
     197        level = 'Info';
     198    }
     199    if(AdobeEdge.edgesuiteDebug){
     200        console.log('[ DEBUG | EdgeSuite | ' + level + ']: ' + msg);
     201    }
     202}
Note: See TracChangeset for help on using the changeset viewer.