From 569998670c92607476ae770db0006023424498e7 Mon Sep 17 00:00:00 2001 From: Michael Sisk Date: Mon, 2 Dec 2013 21:45:22 -0500 Subject: [PATCH] Mindless refactoring. --- -/js/admin-config.js | 80 +++++++++++++++++++-------------------- -/js/admin-legacy.js | 6 +-- -/js/admin-media.js | 54 +++++++++++++------------- -/js/admin-meta.js | 34 ++++++++--------- -/js/admin-pages.js | 20 +++++----- -/js/admin-posts.js | 28 +++++++------- -/js/admin-showcase.js | 22 +++++------ -/js/admin-taxonomy.js | 46 +++++++++++----------- -/js/admin-transcripts.js | 36 +++++++++--------- -/js/admin-widgets.js | 34 ++++++++--------- -/js/dropdown.js | 4 +- -/js/dynamic.js | 18 ++++----- -/js/gestures.js | 56 +++++++++++++-------------- 13 files changed, 219 insertions(+), 219 deletions(-) diff --git a/-/js/admin-config.js b/-/js/admin-config.js index 4d09a88..d150fbc 100644 --- a/-/js/admin-config.js +++ b/-/js/admin-config.js @@ -1,72 +1,72 @@ jQuery( function( $ ) { - var url = $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ); + var url = $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ); /** Update collection slug previews. */ - $( '#webcomic_slugs_archive,#webcomic_slugs_webcomic,#webcomic_slugs_storyline,#webcomic_slugs_character' ).on( 'change', function() { + $( "#webcomic_slugs_archive,#webcomic_slugs_webcomic,#webcomic_slugs_storyline,#webcomic_slugs_character" ).on( "change", function() { $.getJSON( url, { slug: $( this ).val(), - preview: '#' + $( this ).attr( 'id' ), - collection: $( '[name=webcomic_collection]' ).val(), - webcomic_admin_ajax: 'WebcomicConfig::ajax_slug_preview' + preview: "#" + $( this ).attr( "id" ), + collection: $( "[name=webcomic_collection]" ).val(), + webcomic_admin_ajax: "WebcomicConfig::ajax_slug_preview" }, function( data ) { - $( data.container ).val( data.slug ).siblings( '.description' ).children( 'b' ).html( data.slug ) + $( data.container ).val( data.slug ).siblings( ".description" ).children( "b" ).html( data.slug ) } ); } ); /** Enable or disable print defaults. */ - $( '#webcomic_commerce_business' ).on( 'change', function() { + $( "#webcomic_commerce_business" ).on( "change", function() { $.getJSON( url, { business: $( this ).val(), - webcomic_admin_ajax: 'WebcomicConfig::ajax_commerce_defaults' + webcomic_admin_ajax: "WebcomicConfig::ajax_commerce_defaults" }, function ( data ) { if ( data.clear ) { - $( '#webcomic_commerce_prints,#webcomic_commerce_originals' ).removeAttr( 'disabled' ).siblings( 'span' ).removeClass( 'description' ); + $( "#webcomic_commerce_prints,#webcomic_commerce_originals" ).removeAttr( "disabled" ).siblings( "span" ).removeClass( "description" ); } else { - $( '#webcomic_commerce_prints,#webcomic_commerce_originals' ).removeAttr( 'checked' ).attr( 'disabled', true ).siblings( 'span' ).addClass( 'description' ); + $( "#webcomic_commerce_prints,#webcomic_commerce_originals" ).removeAttr( "checked" ).attr( "disabled", true ).siblings( "span" ).addClass( "description" ); } } ); - } ).trigger( 'change' ); + } ).trigger( "change" ); /** Update Twitter authorized account. */ - $( '#webcomic_twitter_consumer_key,#webcomic_twitter_consumer_secret' ).on( 'change', function() { + $( "#webcomic_twitter_consumer_key,#webcomic_twitter_consumer_secret" ).on( "change", function() { $.get( url, { - consumer_key: $( '#webcomic_twitter_consumer_key' ).val(), - consumer_secret: $( '#webcomic_twitter_consumer_secret' ).val(), - collection: $( '[name=webcomic_collection]' ).val(), - webcomic_admin_ajax: 'WebcomicConfig::ajax_twitter_account' + consumer_key: $( "#webcomic_twitter_consumer_key" ).val(), + consumer_secret: $( "#webcomic_twitter_consumer_secret" ).val(), + collection: $( "[name=webcomic_collection]" ).val(), + webcomic_admin_ajax: "WebcomicConfig::ajax_twitter_account" }, function ( data ) { - $( '#webcomic_twitter_account' ).html( data ); + $( "#webcomic_twitter_account" ).html( data ); } ); } ); /** Remove the webcomic image. */ - $( document ).on( 'click', '.webcomic-image-x', function() { + $( document ).on( "click", ".webcomic-image-x", function() { $e = $( this ); $.get( url, { id: 0, - webcomic_admin_ajax: $e.data( 'callback' ) + webcomic_admin_ajax: $e.data( "callback" ) }, function( data ) { - $( $e.data( 'target' ) ).html( data ); + $( $e.data( "target" ) ).html( data ); } ); } ); /** Toggle collection setting sections. */ - $( '.wrap h3' ).css( { - 'border-top': 'thin solid #dfdfdf', - color: '#21759b', - cursor: 'pointer', - padding: '.5em 0 0' - } ).nextAll( 'table' ).hide(); + $( ".wrap h3" ).css( { + "border-top": "thin solid #ddd", + color: "#0074a2", + cursor: "pointer", + padding: ".5em 0 0" + } ).nextAll( "table" ).hide(); - $( '.wrap h3' ).on( 'mouseenter', function() { $( this ).css( 'color', '#d54e21' ); } ); - $( '.wrap h3' ).on( 'mouseleave', function() { $( this ).css( 'color', '#21759b' ); } ); + $( ".wrap h3" ).on( "mouseenter", function() { $( this ).css( "color", "#2ea2cc" ); } ); + $( ".wrap h3" ).on( "mouseleave", function() { $( this ).css( "color", "#0074a2" ); } ); - $( '.wrap h3' ).on( 'click', function() { - $( this ).nextAll( 'table:first' ).toggle(); + $( ".wrap h3" ).on( "click", function() { + $( this ).nextAll( "table:first" ).toggle(); } ); - $( '.wrap :not(table) + h3:first' ).trigger( 'click' ); + $( ".wrap :not(table) + h3:first" ).trigger( "click" ); } ); /** Enable fancy image selection. */ @@ -74,7 +74,7 @@ jQuery( function( $ ) { var frame; $( function() { - $( document ). on( 'click', '.webcomic-image', function( e ) { + $( document ). on( "click", ".webcomic-image", function( e ) { var $e = $( this ); e.preventDefault(); @@ -86,21 +86,21 @@ jQuery( function( $ ) { } frame = wp.media.frames.webcomicPoster = wp.media( { - title: $e.data( 'title' ), + title: $e.data( "title" ), library: { - type: 'image' + type: "image" }, button: { - text: $e.data( 'update' ) + text: $e.data( "update" ) } } ); - frame.on( 'select', function() { - $.get( $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ), { - id: frame.state().get( 'selection' ).first().id, - webcomic_admin_ajax: $e.data( 'callback' ) + frame.on( "select", function() { + $.get( $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ), { + id: frame.state().get( "selection" ).first().id, + webcomic_admin_ajax: $e.data( "callback" ) }, function( data ) { - $( $e.data( 'target' ) ).html( data ); + $( $e.data( "target" ) ).html( data ); } ); } ); diff --git a/-/js/admin-legacy.js b/-/js/admin-legacy.js index 8af46a6..0ba923c 100644 --- a/-/js/admin-legacy.js +++ b/-/js/admin-legacy.js @@ -1,12 +1,12 @@ /** Automatically continue legacy upgrades. */ jQuery( function( $ ) { setTimeout( function() { - $( '.webcomic-auto #upgrade_legacy' ).trigger( 'click' ); + $( ".webcomic-auto #upgrade_legacy" ).trigger( "click" ); }, 5000 ); - $( '.webcomic-auto #upgrade_legacy' ).on( 'click', function() { + $( ".webcomic-auto #upgrade_legacy" ).on( "click", function() { $( this ).hide(); - $( '.webcomic-auto-message' ).html( $( '[data-webcomic-upgrade-continue]' ).data( 'webcomic-upgrade-continue' ) ); + $( ".webcomic-auto-message" ).html( $( "[data-webcomic-upgrade-continue]" ).data( "webcomic-upgrade-continue" ) ); } ); } ); \ No newline at end of file diff --git a/-/js/admin-media.js b/-/js/admin-media.js index b818311..c113e67 100644 --- a/-/js/admin-media.js +++ b/-/js/admin-media.js @@ -1,14 +1,14 @@ jQuery( function( $ ) { - var url = $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ); + var url = $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ); /** Warn if no selected days match the start date. */ - $( 'form.webcomic-generator' ).on( 'submit', function() { - var v = $( 'input[name="webcomic_generate_start"]' ).val().split( '-' ), + $( "form.webcomic-generator" ).on( "submit", function() { + var v = $( "input[name='webcomic_generate_start']" ).val().split( "-" ), d = new Date( v[ 0 ], parseInt( v[ 1 ] ) - 1, v[ 2 ] ), x = false, d1 = d2 = 0; - $.each( $( 'input[name="webcomic_generate_days[]"]:checked' ), function( i, e ) { + $.each( $( "input[name='webcomic_generate_days[]']:checked" ), function( i, e ) { d1 = parseInt( $( e ).val() ); d2 = parseInt( d.getDay() ); @@ -20,56 +20,56 @@ jQuery( function( $ ) { } ); if ( !x ) { - return window.confirm( $( '[data-webcomic-daycheck]' ).data( 'webcomic-daycheck' ) ); + return window.confirm( $( "[data-webcomic-daycheck]" ).data( "webcomic-daycheck" ) ); } } ); /** Allow media to be reordered when using the generator. */ - $( '.webcomic-generator .wp-list-table tbody' ).sortable(); + $( ".webcomic-generator .wp-list-table tbody" ).sortable(); /** Handle webcomic media reordering. */ - $( '.webcomic-media-sort' ).sortable( { + $( ".webcomic-media-sort" ).sortable( { update: function() { $.post( url, { - ids: $( '[name="ids[]"]' ).serializeArray(), - webcomic_admin_ajax: 'WebcomicMedia::ajax_sort_media' + ids: $( "[name='ids[]']" ).serializeArray(), + webcomic_admin_ajax: "WebcomicMedia::ajax_sort_media" }, function( data ) { - var message = $( 'div p' ).html(); + var message = $( "div p" ).html(); - $( 'div p' ).html( data ); + $( "div p" ).html( data ); setTimeout( function() { - $( 'div p' ).html( message ); + $( "div p" ).html( message ); }, 3000 ); } ); } } ); /** Add regenerate and detach bulk actions. */ - $( 'body.wp-admin.upload-php [name="action"],body.wp-admin.upload-php [name="action2"]' ).append( '' + $( "body.wp-admin.upload-php [name='action'],body.wp-admin.upload-php [name='action2']" ).append( "" ); - $( 'body.wp-admin.upload-php #doaction' ).on( 'click', function( e ) { - if ( 'webcomic_regenerate' === $( '[name="action"]' ).val() || 'webcomic_detach' === $( '[name="action"]' ).val() ) { - webcomic_bulk_action( $( '[name="action"]' ) ); + $( "body.wp-admin.upload-php #doaction" ).on( "click", function( e ) { + if ( "webcomic_regenerate" === $( "[name='action']" ).val() || "webcomic_detach" === $( "[name='action']" ).val() ) { + webcomic_bulk_action( $( "[name='action']" ) ); } } ); - $( 'body.wp-admin.upload-php #doaction2' ).on( 'click', function( e ) { - if ( 'webcomic_regenerate' === $( '[name="action2"]' ).val() || 'webcomic_detach' === $( '[name="action2"]' ).val() ) { - webcomic_bulk_action( $( '[name="action2"]' ) ); + $( "body.wp-admin.upload-php #doaction2" ).on( "click", function( e ) { + if ( "webcomic_regenerate" === $( "[name='action2']" ).val() || "webcomic_detach" === $( "[name='action2']" ).val() ) { + webcomic_bulk_action( $( "[name='action2']" ) ); } } ); function webcomic_bulk_action( $el ) { - var $form = $el.parents( 'form' ); + var $form = $el.parents( "form" ); - $el.attr( 'name', 'webcomic_action' ); - $form.attr( 'method', 'post' ); - $form.attr( 'action', url ); + $el.attr( "name", "webcomic_action" ); + $form.attr( "method", "post" ); + $form.attr( "action", url ); } } ); \ No newline at end of file diff --git a/-/js/admin-meta.js b/-/js/admin-meta.js index 9193f32..68c6df2 100644 --- a/-/js/admin-meta.js +++ b/-/js/admin-meta.js @@ -2,45 +2,45 @@ var wpActiveEditor; jQuery( function( $ ) { /** Refresh the webcomic media meta box. */ - $( document ).on( 'mousedown', '.media-modal-close,.media-modal-backdrop,.media-button-insert', function() { + $( document ).on( "mousedown", ".media-modal-close,.media-modal-backdrop,.media-button-insert", function() { setTimeout( function() { - $.get( $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ), { - post: $( '#post_ID' ).val(), - webcomic_admin_ajax: 'WebcomicPosts::ajax_media_preview' + $.get( $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ), { + post: $( "#post_ID" ).val(), + webcomic_admin_ajax: "WebcomicPosts::ajax_media_preview" }, function( data ) { - $( '#webcomic_media_preview' ).html( data ); + $( "#webcomic_media_preview" ).html( data ); } ); }, 500 ); } ); /** Dynamically update the price preview for prints. */ - $( '#webcomic_commerce_adjust_prices_domestic,#webcomic_commerce_adjust_shipping_domestic' ).on( 'change', function() { - calculate_total( 'domestic' ); + $( "#webcomic_commerce_adjust_prices_domestic,#webcomic_commerce_adjust_shipping_domestic" ).on( "change", function() { + calculate_total( "domestic" ); } ); - $( '#webcomic_commerce_adjust_prices_international,#webcomic_commerce_adjust_shipping_international' ).on( 'change', function() { - calculate_total( 'international' ); + $( "#webcomic_commerce_adjust_prices_international,#webcomic_commerce_adjust_shipping_international" ).on( "change", function() { + calculate_total( "international" ); } ); - $( '#webcomic_commerce_adjust_prices_original,#webcomic_commerce_adjust_shipping_original' ).on( 'change', function() { - calculate_total( 'original' ); + $( "#webcomic_commerce_adjust_prices_original,#webcomic_commerce_adjust_shipping_original" ).on( "change", function() { + calculate_total( "original" ); } ); - $( '#webcomic_commerce_original_available' ).on( 'click', function() { - calculate_total( 'original' ); + $( "#webcomic_commerce_original_available" ).on( "click", function() { + calculate_total( "original" ); } ); /** Calculate and update print prices. */ function calculate_total( id ) { var total; - if ( 'original' === id && !$( '#webcomic_commerce_original_available' ).attr( 'checked' ) ) { - $( '#webcomic_original_total' ).html( $( '[data-webcomic-original]' ).data( 'webcomic-original' ) ); + if ( "original" === id && !$( "#webcomic_commerce_original_available" ).attr( "checked" ) ) { + $( "#webcomic_original_total" ).html( $( "[data-webcomic-original]" ).data( "webcomic-original" ) ); } else { - total = ( parseFloat( $( '#webcomic_commerce_' + id + '_price' ).html() ) * ( 1 + ( parseFloat( $( '#webcomic_commerce_adjust_prices_' + id ).val() ) * .01 ) ) ) + ( parseFloat( $( '#webcomic_commerce_' + id + '_shipping' ).html() ) * ( 1 + ( parseFloat( $( '#webcomic_commerce_adjust_shipping_' + id ).val() ) * .01 ) ) ); + total = ( parseFloat( $( "#webcomic_commerce_" + id + "_price" ).html() ) * ( 1 + ( parseFloat( $( "#webcomic_commerce_adjust_prices_" + id ).val() ) * .01 ) ) ) + ( parseFloat( $( "#webcomic_commerce_" + id + "_shipping" ).html() ) * ( 1 + ( parseFloat( $( "#webcomic_commerce_adjust_shipping_" + id ).val() ) * .01 ) ) ); - $( '#webcomic_' + id + '_total' ).html( total.toFixed( 2 ) + ' ' + $( '[data-webcomic-currency]' ).data( 'webcomic-currency' ) ); + $( "#webcomic_" + id + "_total" ).html( total.toFixed( 2 ) + " " + $( "[data-webcomic-currency]" ).data( "webcomic-currency" ) ); } } } ); \ No newline at end of file diff --git a/-/js/admin-pages.js b/-/js/admin-pages.js index 023c638..6ab0298 100644 --- a/-/js/admin-pages.js +++ b/-/js/admin-pages.js @@ -1,23 +1,23 @@ jQuery( function( $ ) { - var url = $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ); + var url = $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ); /** Update meta data values in the quick edit box for pages. */ - $( document ).on( 'click', 'a.editinline', function() { + $( document ).on( "click", "a.editinline", function() { $.getJSON( url, { - post: $( this ).parents( 'tr' ).attr( 'id' ).substr( 5, $( this ).parents( 'tr' ).attr( 'id' ).length ), - webcomic_admin_ajax: 'WebcomicPages::ajax_quick_edit' + post: $( this ).parents( "tr" ).attr( "id" ).substr( 5, $( this ).parents( "tr" ).attr( "id" ).length ), + webcomic_admin_ajax: "WebcomicPages::ajax_quick_edit" }, function ( data ) { - $( '#webcomic_page_collection' ).val( data.collection ); + $( "#webcomic_page_collection" ).val( data.collection ); } ); } ); /** Save meta data values from the quick edit box for pages. */ - $( '.save' ).on( 'click', function() { + $( ".save" ).on( "click", function() { $.get( url, { - post: $( this ).parents( 'tr' ).attr( 'id' ).substr( 5, $( this ).parents( 'tr' ).attr( 'id' ).length ), - collection: $( '#webcomic_page_collection' ).val(), - webcomic_page_inline_save: $( '#webcomic_page_inline_save' ).val(), - webcomic_admin_ajax: 'WebcomicPages::ajax_quick_save' + post: $( this ).parents( "tr" ).attr( "id" ).substr( 5, $( this ).parents( "tr" ).attr( "id" ).length ), + collection: $( "#webcomic_page_collection" ).val(), + webcomic_page_inline_save: $( "#webcomic_page_inline_save" ).val(), + webcomic_admin_ajax: "WebcomicPages::ajax_quick_save" } ); } ); } ); \ No newline at end of file diff --git a/-/js/admin-posts.js b/-/js/admin-posts.js index 7b152af..8c301aa 100644 --- a/-/js/admin-posts.js +++ b/-/js/admin-posts.js @@ -1,27 +1,27 @@ jQuery( function( $ ) { - var url = $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ); + var url = $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ); /** Update meta data values in the quick edit box for webcomic posts. */ - $( document ).on( 'click', 'a.editinline', function() { + $( document ).on( "click", "a.editinline", function() { $.getJSON( url, { - post: $( this ).parents( 'tr' ).attr( 'id' ).substr( 5, $( this ).parents( 'tr' ).attr( 'id' ).length ), - webcomic_admin_ajax: 'WebcomicPosts::ajax_quick_edit' + post: $( this ).parents( "tr" ).attr( "id" ).substr( 5, $( this ).parents( "tr" ).attr( "id" ).length ), + webcomic_admin_ajax: "WebcomicPosts::ajax_quick_edit" }, function ( data ) { - $( '#webcomic_prints' ).attr( 'checked', data.prints ).attr( 'disabled', data.prints_disabled ); - $( '#webcomic_original' ).attr( 'checked', data.original ); - $( '#webcomic_transcripts' ).attr( 'checked', data.transcripts ); + $( "#webcomic_prints" ).attr( "checked", data.prints ).attr( "disabled", data.prints_disabled ); + $( "#webcomic_original" ).attr( "checked", data.original ); + $( "#webcomic_transcripts" ).attr( "checked", data.transcripts ); } ); } ); /** Save meta data values from the quick edit box for webcomic posts. */ - $( '.save' ).on( 'click', function() { + $( ".save" ).on( "click", function() { $.get( url, { - post: $( this ).parents( 'tr' ).attr( 'id' ).substr( 5, $( this ).parents( 'tr' ).attr( 'id' ).length ), - prints: $( '#webcomic_prints:checked' ).val() ? 1 : 0, - original: $( '#webcomic_original:checked' ).val() ? 1 : 0, - transcripts: $( '#webcomic_transcripts:checked' ).val() ? 1 : 0, - webcomic_inline_save: $( '#webcomic_inline_save' ).val(), - webcomic_admin_ajax: 'WebcomicPosts::ajax_quick_save' + post: $( this ).parents( "tr" ).attr( "id" ).substr( 5, $( this ).parents( "tr" ).attr( "id" ).length ), + prints: $( "#webcomic_prints:checked" ).val() ? 1 : 0, + original: $( "#webcomic_original:checked" ).val() ? 1 : 0, + transcripts: $( "#webcomic_transcripts:checked" ).val() ? 1 : 0, + webcomic_inline_save: $( "#webcomic_inline_save" ).val(), + webcomic_admin_ajax: "WebcomicPosts::ajax_quick_save" } ); } ); } ); \ No newline at end of file diff --git a/-/js/admin-showcase.js b/-/js/admin-showcase.js index e34dd62..5d174f2 100644 --- a/-/js/admin-showcase.js +++ b/-/js/admin-showcase.js @@ -9,18 +9,18 @@ a.pauseControls&&d.hover(function(){clearInterval(p)},function(){m()})}}if("unde jQuery( function( $ ) { /** Handle the Webcomic Showcase slideshow. */ - $( '#webcomic-showcase .slideshow div' ).responsiveSlides( { - 'nav': true, - 'auto': false, - 'speed': 0, - 'nextText': '»', - 'prevText': '«', - 'namespace': 'webcomic-showcase-slides', - 'before': function() { - $( '#webcomic-showcase .slideshow div' ).children( '[class=""]' ).css( 'display', 'block' ); + $( "#webcomic-showcase .slideshow div" ).responsiveSlides( { + nav: true, + auto: false, + speed: 0, + nextText: "»", + prevText: "«", + namespace: "webcomic-showcase-slides", + before: function() { + $( "#webcomic-showcase .slideshow div" ).children( "[class='']" ).css( "display", "block" ); }, - 'after': function() { - $( '#webcomic-showcase .slideshow div' ).children( '[class=""]' ).css( 'display', 'none' ); + after: function() { + $( "#webcomic-showcase .slideshow div" ).children( "[class='']" ).css( "display", "none" ); } } ); } ); \ No newline at end of file diff --git a/-/js/admin-taxonomy.js b/-/js/admin-taxonomy.js index 4a5fccc..92d95dc 100644 --- a/-/js/admin-taxonomy.js +++ b/-/js/admin-taxonomy.js @@ -1,28 +1,28 @@ jQuery( function( $ ) { /** Remove the term image. */ - $( document ).on( 'click', '.webcomic-image-x', function() { - $.get( $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ), { + $( document ).on( "click", ".webcomic-image-x", function() { + $.get( $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ), { id: 0, - taxonomy: $( '[data-webcomic-taxonomy]' ).data( 'webcomic-taxonomy' ), - webcomic_admin_ajax: 'WebcomicTaxonomy::ajax_term_image' + taxonomy: $( "[data-webcomic-taxonomy]" ).data( "webcomic-taxonomy" ), + webcomic_admin_ajax: "WebcomicTaxonomy::ajax_term_image" }, function( data ) { - $( '#webcomic_term_image' ).html( data ); + $( "#webcomic_term_image" ).html( data ); } ); } ); /** Enable dynamic term sorting. */ - $( '.webcomic-sort' ).nestedSortable( { - handle: 'b', - items: 'li', + $( ".webcomic-sort" ).nestedSortable( { + handle: "b", + items: "li", tabSize: 36, - toleranceElement: '> b', - placeholder: 'webcomic-drop', + toleranceElement: "> b", + placeholder: "webcomic-drop", update: function( e, ui ) { - $( '[name="webcomic_terms"]' ).val( $( '.webcomic-sort' ).nestedSortable( 'serialize' ) ); + $( "[name='webcomic_terms']" ).val( $( ".webcomic-sort" ).nestedSortable( "serialize" ) ); } } ); - $( '[name="webcomic_terms"]' ).val( $( '.webcomic-sort' ).nestedSortable( 'serialize' ) ); + $( "[name='webcomic_terms']" ).val( $( ".webcomic-sort" ).nestedSortable( "serialize" ) ); } ); /** Enable fancy taxonomy images. */ @@ -30,7 +30,7 @@ jQuery( function( $ ) { var frame; $( function() { - $( document ). on( 'click', '.webcomic-image', function( e ) { + $( document ). on( "click", ".webcomic-image", function( e ) { var $e = $( this ); e.preventDefault(); @@ -42,23 +42,23 @@ jQuery( function( $ ) { } frame = wp.media.frames.webcomicTermImage = wp.media( { - title: $e.data( 'title' ), + title: $e.data( "title" ), library: { - type: 'image' + type: "image" }, button: { - text: $e.data( 'update' ) + text: $e.data( "update" ) } } ); - frame.on( 'select', function() { - $.get( $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ), { - id: frame.state().get( 'selection' ).first().id, - taxonomy: $( '[data-webcomic-taxonomy]' ).data( 'webcomic-taxonomy' ), - term: $( 'data-webcomic-term' ).data( 'webcomic-term' ), - webcomic_admin_ajax: 'WebcomicTaxonomy::ajax_term_image' + frame.on( "select", function() { + $.get( $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ), { + id: frame.state().get( "selection" ).first().id, + taxonomy: $( "[data-webcomic-taxonomy]" ).data( "webcomic-taxonomy" ), + term: $( "data-webcomic-term" ).data( "webcomic-term" ), + webcomic_admin_ajax: "WebcomicTaxonomy::ajax_term_image" }, function( data ) { - $( '#webcomic_term_image' ).html( data ); + $( "#webcomic_term_image" ).html( data ); } ); } ); diff --git a/-/js/admin-transcripts.js b/-/js/admin-transcripts.js index bd13830..e3154e5 100644 --- a/-/js/admin-transcripts.js +++ b/-/js/admin-transcripts.js @@ -1,47 +1,47 @@ jQuery( function( $ ) { - var url = $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ); + var url = $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ); /** Update the post list when the collection is changed. */ - $( '#webcomic_collection' ).attr( 'disabled', false ).on( 'change', function() { + $( "#webcomic_collection" ).attr( "disabled", false ).on( "change", function() { $.get( url, { - collection: $( '#webcomic_collection' ).val(), - parent: $( '#webcomic_parent' ).val(), - webcomic_admin_ajax: 'WebcomicTranscripts::ajax_posts' + collection: $( "#webcomic_collection" ).val(), + parent: $( "#webcomic_parent" ).val(), + webcomic_admin_ajax: "WebcomicTranscripts::ajax_posts" }, function( data ) { - $( '#webcomic_post_list' ).html( data ); - $( '#webcomic_post' ).trigger( 'change' ); + $( "#webcomic_post_list" ).html( data ); + $( "#webcomic_post" ).trigger( "change" ); } ); } ); /** Update the webcomic preview when the post is changed. */ - $( document ).on( 'change', '#webcomic_post', function() { + $( document ).on( "change", "#webcomic_post", function() { $.get( url, { - parent: $( '#webcomic_post' ).val() ? $( '#webcomic_post' ).val() : 0, - webcomic_admin_ajax: 'WebcomicTranscripts::ajax_post_transcripts' + parent: $( "#webcomic_post" ).val() ? $( "#webcomic_post" ).val() : 0, + webcomic_admin_ajax: "WebcomicTranscripts::ajax_post_transcripts" }, function( data ) { - $( '#webcomic_post_transcripts' ).html( data ); + $( "#webcomic_post_transcripts" ).html( data ); } ); $.get( url, { - post: $( '#webcomic_post' ).val() ? $( '#webcomic_post' ).val() : 0, - webcomic_admin_ajax: 'WebcomicTranscripts::ajax_preview' + post: $( "#webcomic_post" ).val() ? $( "#webcomic_post" ).val() : 0, + webcomic_admin_ajax: "WebcomicTranscripts::ajax_preview" }, function( data ) { - $( '#webcomic_post_preview' ).html( data ); + $( "#webcomic_post_preview" ).html( data ); } ); } ); /** Add a new row for custom authors. */ - $( '#webcomic_author_add' ).on( 'click', function() { + $( "#webcomic_author_add" ).on( "click", function() { var key = ( new Date() ).getTime(); - $( '#webcomic_author_table tbody' ).append( '' ); + $( "#webcomic_author_table tbody" ).append( "" ); return false; } ); /** Delete an existing author row. */ - $( document ).on( 'click', '#webcomic_author_table .delete', function() { - $( this ).parents( 'tr' ).remove(); + $( document ).on( "click", "#webcomic_author_table .delete", function() { + $( this ).parents( "tr" ).remove(); return false; } ); diff --git a/-/js/admin-widgets.js b/-/js/admin-widgets.js index ab9604f..47a7450 100644 --- a/-/js/admin-widgets.js +++ b/-/js/admin-widgets.js @@ -1,17 +1,17 @@ jQuery( function( $ ) { - var url = $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ); + var url = $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ); /** Remove the webcomic image. */ - $( document ).on( 'click', '.webcomic-image-x', function() { + $( document ).on( "click", ".webcomic-image-x", function() { var $e = $( this ); $.get( url, { id: 0, - name: $e.data( 'name' ), - target: $e.data( 'target' ), - webcomic_admin_ajax: $e.data( 'callback' ) + name: $e.data( "name" ), + target: $e.data( "target" ), + webcomic_admin_ajax: $e.data( "callback" ) }, function( data ) { - $( $e.closest( $e.data( 'target' ) ) ).html( data ); + $( $e.closest( $e.data( "target" ) ) ).html( data ); } ); } ); } ); @@ -21,29 +21,29 @@ jQuery( function( $ ) { var frame; $( function() { - $( document ).on( 'click', '.webcomic-image', function( e ) { + $( document ).on( "click", ".webcomic-image", function( e ) { var $e = $( this ); e.preventDefault(); frame = wp.media.frames.webcomicWidgetImage = wp.media( { - title: $e.data( 'title' ), + title: $e.data( "title" ), library: { - type: 'image' + type: "image" }, button: { - text: $e.data( 'update' ) + text: $e.data( "update" ) } } ); - frame.on( 'select', function() { - $.get( $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ), { - id: frame.state().get( 'selection' ).first().id, - name: $e.data( 'name' ), - target: $e.data( 'target' ), - webcomic_admin_ajax: $e.data( 'callback' ) + frame.on( "select", function() { + $.get( $( "[data-webcomic-admin-url]" ).data( "webcomic-admin-url" ), { + id: frame.state().get( "selection" ).first().id, + name: $e.data( "name" ), + target: $e.data( "target" ), + webcomic_admin_ajax: $e.data( "callback" ) }, function( data ) { - $( $e.closest( $e.data( 'target' ) ) ).html( data ); + $( $e.closest( $e.data( "target" ) ) ).html( data ); } ); } ); diff --git a/-/js/dropdown.js b/-/js/dropdown.js index d4b21c1..34bb7ae 100644 --- a/-/js/dropdown.js +++ b/-/js/dropdown.js @@ -1,7 +1,7 @@ /** Enable webcomic dropdown navigation. */ jQuery( function( $ ) { - $( 'select.webcomic-terms,select.webcomic-collections,select.webcomic-transcript-terms' ).on( 'change', function() { - var url = $( this ).find( 'option:selected' ).data( 'webcomic-url' ); + $( "select.webcomic-terms,select.webcomic-collections,select.webcomic-transcript-terms" ).on( "change", function() { + var url = $( this ).find( "option:selected" ).data( "webcomic-url" ); if ( url ) { window.location.href = url; diff --git a/-/js/dynamic.js b/-/js/dynamic.js index f59848e..7926cb1 100644 --- a/-/js/dynamic.js +++ b/-/js/dynamic.js @@ -1,12 +1,12 @@ /** Enable dynamic webcomic navigation. */ jQuery( function( $ ) { - if ( $( '[data-webcomic-container]' ) ) { + if ( $( "[data-webcomic-container]" ) ) { var defaults = []; - $( '[data-webcomic-container]' ).each( function() { + $( "[data-webcomic-container]" ).each( function() { defaults.push( { - parent: $( this ).find( '[data-webcomic-parent]' ).data( 'webcomic-parent' ), - container: $( this ).data( 'webcomic-container' ) + parent: $( this ).find( "[data-webcomic-parent]" ).data( "webcomic-parent" ), + container: $( this ).data( "webcomic-container" ) } ); } ); @@ -16,11 +16,11 @@ jQuery( function( $ ) { function dynamic_webcomic( url, container ) { $.get( url, { webcomic_dynamic: container }, function( data ) { - $( '[data-webcomic-container="' + container + '"]' ).html( data ).show(); + $( "[data-webcomic-container='" + container + "']" ).html( data ).show(); } ); } - $( window ).on( 'popstate', function( e ) { + $( window ).on( "popstate", function( e ) { if ( e.originalEvent.state ) { if ( e.originalEvent.state.webcomicReset ) { $.each( defaults, function( i, v ) { @@ -34,11 +34,11 @@ jQuery( function( $ ) { } } ); - $( document ).on( 'click', '[data-webcomic-container] [href].webcomic-link', function( e ) { + $( document ).on( "click", "[data-webcomic-container] [href].webcomic-link", function( e ) { e.preventDefault(); - var url = $( this ).attr( 'href' ); - var container = $( this ).closest( '[data-webcomic-container]' ).data( 'webcomic-container' ); + var url = $( this ).attr( "href" ); + var container = $( this ).closest( "[data-webcomic-container]" ).data( "webcomic-container" ); dynamic_webcomic( url, container ); diff --git a/-/js/gestures.js b/-/js/gestures.js index 3bb2bfc..6920219 100644 --- a/-/js/gestures.js +++ b/-/js/gestures.js @@ -2,7 +2,7 @@ jQuery( function( $ ) { var canvas, end, start, scroll; - $( '[data-webcomic-gestures]' ).on( 'touchstart', function( e ) { + $( "[data-webcomic-gestures]" ).on( "touchstart", function( e ) { canvas = $( this ); start = e.originalEvent; scroll = $( e.target ); @@ -16,7 +16,7 @@ jQuery( function( $ ) { }; while ( scroll.e = scroll.e.parent() ) { - if ( scroll.e.prop( 'scrollWidth' ) > scroll.e.width() || scroll.e.prop( 'scrollHeight' ) > scroll.e.height() ) { + if ( scroll.e.prop( "scrollWidth" ) > scroll.e.width() || scroll.e.prop( "scrollHeight" ) > scroll.e.height() ) { break; } @@ -31,11 +31,11 @@ jQuery( function( $ ) { } } ); - $( '[data-webcomic-gestures]' ).on( 'touchmove', function( e ) { + $( "[data-webcomic-gestures]" ).on( "touchmove", function( e ) { end = e.originalEvent; } ); - $( '[data-webcomic-gestures]' ).on( 'touchend', function( e ) { + $( "[data-webcomic-gestures]" ).on( "touchend", function( e ) { if ( end ) { var x, y, a, b, d, $e; @@ -45,56 +45,56 @@ jQuery( function( $ ) { b = Math.abs( y ); if ( a > b ) { - d = 0 > x ? 'left' : 'right'; + d = 0 > x ? "left" : "right"; } else { - d = 0 > y ? 'up' : 'down'; + d = 0 > y ? "up" : "down"; } if ( !webcomic_scrolling( d ) ) { if ( 1 === end.touches.length ) { - if ( 'left' === d ) { - $e = $( '.previous-webcomic-link[href]:first', canvas ); - } else if ( 'right' === d ) { - $e = $( '.next-webcomic-link[href]:first', canvas ); + if ( "left" === d ) { + $e = $( ".previous-webcomic-link[href]:first", canvas ); + } else if ( "right" === d ) { + $e = $( ".next-webcomic-link[href]:first", canvas ); } } else if ( 2 == end.touches.length ) { - if ( 'left' === d ) { - $e = $( '.first-webcomic-link[href]:first', canvas ); - } else if ( 'right' === d ) { - $e = $( '.last-webcomic-link[href]:first', canvas ); - } else if ( 'up' === d ) { - $e = $( '.purchase-webcomic-link[href]:first', canvas ); - } else if ( 'down' === d ) { - $e = $( '.random-webcomic-link[href]:first', canvas ); + if ( "left" === d ) { + $e = $( ".first-webcomic-link[href]:first", canvas ); + } else if ( "right" === d ) { + $e = $( ".last-webcomic-link[href]:first", canvas ); + } else if ( "up" === d ) { + $e = $( ".purchase-webcomic-link[href]:first", canvas ); + } else if ( "down" === d ) { + $e = $( ".random-webcomic-link[href]:first", canvas ); } } if ( $e && $e.length ) { e.preventDefault(); - if ( $.fn.webcomicDynamicNavigation && $e.closest( '[data-webcomic-container]' ).length ) { - $e.trigger( 'click' ); + if ( $.fn.webcomicDynamicNavigation && $e.closest( "[data-webcomic-container]" ).length ) { + $e.trigger( "click" ); } else { - window.location.href = $e.attr( 'href' ); + window.location.href = $e.attr( "href" ); } } } } } ); - $( '[data-webcomic-gestures]' ).on( 'touchcancel', function( e ) { + $( "[data-webcomic-gestures]" ).on( "touchcancel", function( e ) { end = start = scroll = false; } ); function webcomic_scrolling( direction ) { if ( scroll && 1 === end.touches.length ) { - if ( 'left' === direction && scroll.x ) { - return scroll.e.prop( 'scrollWidth' ) - scroll.e.scrollLeft() !== scroll.e.outerWidth(); - } else if ( 'right' === direction && scroll.x ) { + if ( "left" === direction && scroll.x ) { + return scroll.e.prop( "scrollWidth" ) - scroll.e.scrollLeft() !== scroll.e.outerWidth(); + } else if ( "right" === direction && scroll.x ) { return 0 !== scroll.e.scrollLeft(); - } else if ( 'up' === direction && scroll.y ) { - return scroll.e.prop( 'scrollHeight' ) - scroll.e.scrollTop() === scroll.e.outerHeight(); - } else if ( 'down' === direction && scroll.y ) { + } else if ( "up" === direction && scroll.y ) { + return scroll.e.prop( "scrollHeight" ) - scroll.e.scrollTop() === scroll.e.outerHeight(); + } else if ( "down" === direction && scroll.y ) { return 0 !== scroll.e.scrollTop(); } }