Plugin Directory

Changeset 1188826


Ignore:
Timestamp:
06/28/2015 03:21:05 AM (11 years ago)
Author:
mmtechmaster
Message:

Committing nightly updates into development version (1.1.4). Note this version is UNSTABLE.

Location:
militant-moderates-css-parent-selector-mmps/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • militant-moderates-css-parent-selector-mmps/trunk/css/mmParentSelector.css

    r1188234 r1188826  
    11/**
    22 * @package militant-moderates-css-parent-selector-mmps
    3  * @version 1.1.3
     3 * @version 1.1.4
    44 */
    55/*
     
    77Plugin URI: http://www.militantmoderates.org/mmps-quick-start/
    88Description: Adds CSS "Parent Selector" support to your Theme. Apply your CSS Style to Parent/Sibling elements not just the Selected element.
    9 Version: 1.1.3
     9Version: 1.1.4
    1010Author: MM Techmaster
    1111Author URI: https://profiles.wordpress.org/mmtechmaster
  • militant-moderates-css-parent-selector-mmps/trunk/js/mmParentSelector.js

    r1188234 r1188826  
    11/**
    22 * @package militant-moderates-css-parent-selector-mmps
    3  * @version 1.1.3
     3 * @version 1.1.4
    44 */
    55/*
     
    77Plugin URI: http://www.militantmoderates.org/mmps-quick-start/
    88Description: Adds CSS "Parent Selector" support to your Theme. Apply your CSS Style to Parent/Sibling elements not just the Selected element.
    9 Version: 1.1.3
     9Version: 1.1.4
    1010Author: MM Techmaster
    1111Author URI: https://profiles.wordpress.org/mmtechmaster
     
    3535
    3636    eventMap = {
     37        abort: 'abort',
    3738        active: 'focusin',
     39        click: 'click',
     40        dblclick: 'dblclick',
    3841        focus: 'focusin',
     42        focusout: 'focusout',
    3943        hover: 'mouseover',
     44        keyup: 'keyup',
     45        load: 'load',
     46        mouseleave: 'mouseleave',
     47        mousemove: 'mousemove',
     48        mouseout: 'mouseout',
     49        mouseup: 'mouseup',
     50        resize: 'resize',
     51        scroll: 'scroll',
     52        select: 'select',
     53        unload: 'unload',
     54        visited: 'click',
     55        wheel: 'wheel',
    4056    },
    4157
    4258    pairedEventMap = {
    43         mousedown: 'mouseup mouseout mouseleave',
    4459        focusin: 'focusout',
    4560        keydown: 'keyup',
     61        mousedown: 'mouseup mouseout mouseleave',
    4662        mouseenter: 'mouseleave',
    4763        mouseover: 'mouseout',
     
    114130
    115131                // parse Selector portion of Style
    116                 selectors = $.trim(style.split('{')[0]).split(',');
     132                selectors = $.trim(style.split('{')[0]).split( /\s*,\s*/ );
    117133
    118134                // parse Declarations portion of Style
    119                 declarations = '{' + style.split(/\{|\}/)[1].replace(/^\s+|\s+$[\t\n\r]*/g, '') + '}';
     135                declarations = '{' + style.split( /\{|\}/ )[1].replace( /^\s+|\s+$[\t\n\r]*/g, '' ) + '}';
    120136
    121137                // skip empty declarations
     
    135151                    (parsedSelectors.length) && (parsedSelectors += ",");
    136152
     153                    // Split the selector on the '!' and save results
     154                    var splitsel = selector.split('!');
     155
    137156                    if (/!/.test(selector) ) {
    138157                        // Split the selector on the '!' and save results
    139158                        var splitsel = selector.split('!');
     159                       
     160                        // recombine remaining array members in case a second '!' was included
     161                        if (splitsel.length > 2)
     162                            splitsel[1] = splitsel.slice(1).join('!');
    140163
    141164                        // Parse Parent from Selector
     
    143166
    144167                        // parse Parent and ALL Pseudo Parents :before :after :hover :click etc.
    145                         parent = $.trim(splitp[0]);
    146                         pseudoParents = splitp.slice(1);        // get all Pseudo Parents
     168                        parent = $.trim(splitp[0]);             // first member is Parent Element
     169                        pseudoParents = splitp.slice(1);        // all remaining members are Pseudo Classes or Elements
    147170
    148171                        // parse Target from Selector
     
    154177
    155178                        // Build Child Selector - Same as Selector but without '!'
     179                        // Remove '!' Parent Selector designator and convert double colons to single
    156180                        childSelector = selector.replace(/!/g, '').replace('::', ':');
     181
    157182                        // Remove ALL Parent Pseudo Classes and Pseudo Elements
    158                         $(pseudoParents).each(function(x) {
     183                        $(pseudoParents).each(function() {
    159184                            childSelector = childSelector.replace( ':' + this, '' );
    160185                        });
    161186                        // Remove any event-type Target Pseudo Classes from Child Selector
    162                         $(pseudoTargets).each(function(x) {
    163                             if ( eventMap[ this ] ) childSelector = childSelector.replace( ':' + this, '' );
     187                        $(pseudoTargets).each(function() {
     188                            if ( eventMap[ this.toString() ] || pairedEventMap[ this.toString() ] )
     189                                childSelector = childSelector.replace( ':' + this, '' );
    164190                        });
    165191
     
    229255                                    var id = CLASS + k++,
    230256
    231                                     mmpsAddNamespace = function(eType) {
     257                                    addNamespace = function( eType ) {
    232258                                        return eType.split(/[ ]+/).join('.e' + id + ' ') + '.e' + id;
     259                                    },
     260
     261                                    getPseudoElement = function( ppNorm ) {
     262                                        return pseudoElements[ ppNorm.replace(/\-/g, '_') ];
     263                                    },
     264
     265                                    getPseudoState = function( ppNorm ) {
     266                                        var ps = ppNorm.split( '(' );
     267                                        if ( stateMap[ ps[0].replace(/\-/g, '_') ] )
     268                                            return stateMap[ ps[0].replace(/\-/g, '_') ] + ps.slice(1).join( '(' );
     269                                        return false;
     270                                    },
     271                                   
     272                                    getPseudoEvent = function( ppNorm ) {
     273                                        if ( eventMap[ ppNorm ] )
     274                                            return eventMap[ ppNorm ];
     275                                        else if ( pairedEventMap[ ppNorm ] )
     276                                            return ppNorm;
     277                                        return false;
    233278                                    },
    234279
     
    238283                                            // if this is a paired event then build a reverse handler
    239284                                            if ( pairedEventMap[e.type] ) {
    240                                                 $(e.currentTarget).one( mmpsAddNamespace( pairedEventMap[e.type] ), { id: e.data.id, subject: $(e.data.subject) }, function(oe) {
     285                                                $(e.currentTarget).bind( addNamespace( pairedEventMap[e.type] ), { id: e.data.id, subject: $(e.data.subject) }, function(oe) {
    241286                                                    // Make sure all paired event handlers are turned off, not just the one that fired
    242                                                     $(oe.currentTarget).off( mmpsAddNamespace( pairedEventMap[e.type] ) );
     287                                                    $(oe.currentTarget).unbind( addNamespace( pairedEventMap[e.type] ) );
    243288                                                    // Then toggle the Class on the Subject element
    244289                                                    $(oe.data.subject).toggleClass(oe.data.id);
     
    251296                                    };
    252297
     298                                    checkVisitedLink = function(e) {
     299                                        var eid = 'E#' + evidx++, qClass = false;
     300                                        if (e) {
     301                                            // This is a Link element, check to see if it is 'visited'
     302                                            try {
     303                                                if ( $(e.currentTarget).is( ':visited' ) ) {        // use target attribute instead of visited
     304                                                    if (! $(e.data.subject).hasClass( e.data.id ) ) {
     305                                                        qClass = true;      // yes, toggle our Class
     306                                                    }
     307                                                } else {
     308                                                    if ( $(e.data.subject).hasClass( e.data.id ) ) {
     309                                                        qClass = true;      // yes, toggle our Class
     310                                                    }
     311                                                }
     312                                            }
     313                                            catch(err) {
     314                                                if ( $(e.data.subject).hasClass( e.data.id ) ) {
     315                                                    qClass = true;      // yes, toggle our Class
     316                                                }
     317                                            }
     318                                        }
     319
     320                                        // Toggle our special Class in the final subject element if qClass is set
     321                                        if ( qClass ) {
     322                                            $(e.data.subject).toggleClass(e.data.id);
     323                                        }
     324                                    };
     325
    253326                                    idx && (parsedSelectors.length) && (parsedSelectors += ",");
    254327                                    parsedSelectors += '.' + id;
     
    259332                                    // Loops through the Pseudo Parents and apply those that are needed
    260333                                    $(pseudoParents).each(function() {
    261                                         var ppNorm = this.replace(/\-/g, '_');
    262                                         if (pseudoElements[ ppNorm ]) {
    263                                             parsedSelectors += pseudoElements[ ppNorm ];
     334                                        var pe;
     335                                        if ( pe = getPseudoElement( this.toString() ) ) {
     336                                            parsedSelectors += pe;
     337                                            qClass = true;      // apply class later .. maybe
     338                                        } else if ( pe = getPseudoEvent( this.toString() ) ) {
     339                                            // *** MUST check Events before States
     340                                            // It's one of the Event Pseudo Classes :hover :checked :focus
     341                                            $(subject).bind( addNamespace( pe ), { id: id, subject: $(subject) }, toggleFn );
     342                                            // Do not apply Class to the subject - Event will apply it
     343                                            qClass = false;
     344                                        } else if ( pe = getPseudoState( this.toString() ) ) {
     345                                            parsedSelectors += pe;
    264346                                            qClass = true;      // apply class later .. maybe
    265347                                        } else {
    266                                             // it's one of the other Pseudo Classes :hover :click etc.
    267                                             // Build a handler for the specified Pseudo Class
    268                                             $(subject).on( mmpsAddNamespace( eventMap[ this ] || this ), { id: id, subject: $(subject) }, toggleFn );
     348                                            // A non-event, non-state Pseudo - Ignore it
    269349                                        }
    270350                                    });
     
    275355                                        $(pseudoTargets).each(function() {
    276356                                            // Process each Target Pseudo Class or Pseudo Element modifier
    277                                             var pt = this.split(/(?:\(|\))/g);
    278                                             var ptNorm = pt[0].replace(/\-/g, '_');
    279                                             var ptParam = stateMap[ ptNorm ] + ( pt[1] ? '(' + pt[1] + ')' : '' );
    280 
    281                                             if ( pseudoElements[ ptNorm ] ) {
    282                                                 // It's a Pseudo Element ::after, ::before, etc.
    283                                                 // Ignored on the Target element; we're working on the Subject
    284                                             } else if ( eventMap[ this ] ) {
    285                                                 // It's one of the special Event Pseudo Classes :hover :checked :focus
    286                                                 // An event-based Pseudo Class - Build a handler for the Event
    287                                                 $(orgChild).on( mmpsAddNamespace( eventMap[ this ] ), { id: id, subject: $(subject) }, toggleFn );
     357
     358                                            var pe;
     359                                            if ( pe = getPseudoElement( this.toString() ) ) {
     360                                            } else if ( this.toString() == 'visited' && $(orgChild).prop('tagName') == 'A' ) {
     361                                                // the Target Pseudo Class is visited and this is a Link 'A' Element
     362                                                try {
     363                                                    qClass = $(orgChild).is(':visited');        // save state of visited in Target
     364                                                }
     365                                                catch(err) {
     366                                                    qClass = false;
     367                                                }
     368                                                // Hook our special click event handler to check Link's visited status
     369                                                $(orgChild).bind( addNamespace( 'click focus blur' ), { id: id, subject: $(subject) }, checkVisitedLink );
     370                                            } else if ( pe = getPseudoEvent( this.toString() ) ) {
     371                                                // *** MUST check Events before States
     372
     373                                                // It's one of the Event Pseudo Classes :hover :checked :focus
     374                                                $(orgChild).bind( addNamespace( pe ), { id: id, subject: $(subject) }, toggleFn );
    288375                                                // Do not apply Class to the subject - Event will apply it
    289376                                                qClass = false;
    290                                             } else if ( stateMap[ ptNorm ] ) {
     377                                            } else if ( pe = getPseudoState( this.toString() ) ) {
     378                                                // It's one of the State Pseudo Classes :enabled, :disabled, :link
    291379                                                // A normal or special Parameterized Pseudo Class State
    292380                                                qClass = true;
    293381                                            } else {
    294382                                                // An unknown Pseudo Class - DEFAULT is to build a handler for it
    295                                                 $(orgChild).on( mmpsAddNamespace( this.toString() ), { id: id, subject: $(subject) }, toggleFn );
    296                                                 qClass = false;
    297383                                            }
    298384                                        });
     
    354440
    355441        stateMap = {
     442            active: ':active',
    356443            disabled: ':disabled',
    357444            empty: ':empty',
    358445            enabled: ':enabled',
    359446            invalid: ':invalid',
     447            lang: ':lang',
     448            link: ':link',
     449            not: ':not',
    360450            optional: ':optional',
    361451            required: ':required',
    362452            target: ':target',
    363             valid: ':valid'
     453            valid: ':valid',
     454            visited: ':visited'
    364455        };
    365456    }
  • militant-moderates-css-parent-selector-mmps/trunk/js/mmParentSelector.min.js

    r1188234 r1188826  
    11
    2 jQuery(document).ready(function($){var evidx=0,k=0,i,j,CLASS='mmPpSsPrEfIx',eventMap={active:'focusin',focus:'focusin',hover:'mouseover',},pairedEventMap={mousedown:'mouseup mouseout mouseleave',focusin:'focusout',keydown:'keyup',mouseenter:'mouseleave',mouseover:'mouseout',},stateMap={active:':active',disabled:':disabled',empty:':empty',enabled:':enabled',first_child:':first-child',first_of_type:':first-of-type',in_range:':in-range',invalid:':invalid',lang:':lang',last_child:':last-child',last_of_type:':last-of-type',link:':link',not:':not',nth_child:':nth-child',nth_last_child:':nth-last-child',nth_last_of_type:':nth-last-of-type',nth_of_type:':nth-of-type',only_of_type:':only-of-type',only_child:':only-child',optional:':optional',out_of_range:':out-of-range',read_only:':read-only',read_write:':read-write',required:':required',target:':target',valid:':valid',visited:':visited'},pseudoElements={after:'::after',before:'::before',first_letter:'::first-letter',first_line:'::first-line',selection:'::selection'},parsed,parsedSelectors,matches,selectors,selector,parent,target,child,pseudoTargets,declarations,pseudoParent,pseudoParents,childSelector,childElements,REGEX=new RegExp((function(aryRegExp){var ret='';for(var i=0;i<aryRegExp.length;i++)
    3 ret+=aryRegExp[i].source;return ret;})([/[\w\s\/\.\-\:\=\[\]\(\)\~\+\|\,\*\'\"\^$#>]*(?=!)/,/[\w\s\/\.\-\:\=\[\]\(\)\~\+\|\,\*\'\"\^$#>!]*\{{1}/,/[^\}]+\}{1}/]),"gi");parse=function(sRawCSS){sRawCSS=sRawCSS.replace(/(\/\*([\s\S]*?)\*\/)/gm,'');if(matches=sRawCSS.match(REGEX)){parsed='';for(i=-1;++i<matches.length;){style=$.trim(matches[i]);selectors=$.trim(style.split('{')[0]).split(',');declarations='{'+style.split(/\{|\}/)[1].replace(/^\s+|\s+$[\t\n\r]*/g,'')+'}';if(declarations==='{}'){continue;}
     2jQuery(document).ready(function($){var evidx=0,k=0,i,j,CLASS='mmPpSsPrEfIx',eventMap={abort:'abort',active:'focusin',click:'click',dblclick:'dblclick',focus:'focusin',focusout:'focusout',hover:'mouseover',keyup:'keyup',load:'load',mouseleave:'mouseleave',mousemove:'mousemove',mouseout:'mouseout',mouseup:'mouseup',resize:'resize',scroll:'scroll',select:'select',unload:'unload',visited:'click',wheel:'wheel',},pairedEventMap={focusin:'focusout',keydown:'keyup',mousedown:'mouseup mouseout mouseleave',mouseenter:'mouseleave',mouseover:'mouseout',},stateMap={active:':active',disabled:':disabled',empty:':empty',enabled:':enabled',first_child:':first-child',first_of_type:':first-of-type',in_range:':in-range',invalid:':invalid',lang:':lang',last_child:':last-child',last_of_type:':last-of-type',link:':link',not:':not',nth_child:':nth-child',nth_last_child:':nth-last-child',nth_last_of_type:':nth-last-of-type',nth_of_type:':nth-of-type',only_of_type:':only-of-type',only_child:':only-child',optional:':optional',out_of_range:':out-of-range',read_only:':read-only',read_write:':read-write',required:':required',target:':target',valid:':valid',visited:':visited'},pseudoElements={after:'::after',before:'::before',first_letter:'::first-letter',first_line:'::first-line',selection:'::selection'},parsed,parsedSelectors,matches,selectors,selector,parent,target,child,pseudoTargets,declarations,pseudoParent,pseudoParents,childSelector,childElements,REGEX=new RegExp((function(aryRegExp){var ret='';for(var i=0;i<aryRegExp.length;i++)
     3ret+=aryRegExp[i].source;return ret;})([/[\w\s\/\.\-\:\=\[\]\(\)\~\+\|\,\*\'\"\^$#>]*(?=!)/,/[\w\s\/\.\-\:\=\[\]\(\)\~\+\|\,\*\'\"\^$#>!]*\{{1}/,/[^\}]+\}{1}/]),"gi");parse=function(sRawCSS){sRawCSS=sRawCSS.replace(/(\/\*([\s\S]*?)\*\/)/gm,'');if(matches=sRawCSS.match(REGEX)){parsed='';for(i=-1;++i<matches.length;){style=$.trim(matches[i]);selectors=$.trim(style.split('{')[0]).split(/\s*,\s*/);declarations='{'+style.split(/\{|\}/)[1].replace(/^\s+|\s+$[\t\n\r]*/g,'')+'}';if(declarations==='{}'){continue;}
    44if(!/;}$/.test(declarations))
    5 declarations=declarations.replace(/}/g,';}');declarations=declarations.replace(/;/g,' !important;');parsedSelectors='';for(j=-1;++j<selectors.length;){selector=$.trim(selectors[j]);(parsedSelectors.length)&&(parsedSelectors+=",");if(/!/.test(selector)){var splitsel=selector.split('!');var splitp=splitsel[0].split(/[>~+\s]+/).reverse()[0].split(/[\:]+/);parent=$.trim(splitp[0]);pseudoParents=splitp.slice(1);var splitt=splitsel[1].split(/[>~+\s]+/).reverse()[0].split(/[\:]+/);target=$.trim(splitt[0])||[]._;pseudoTargets=splitt.slice(1);childSelector=selector.replace(/!/g,'').replace('::',':');$(pseudoParents).each(function(x){childSelector=childSelector.replace(':'+this,'');});$(pseudoTargets).each(function(x){if(eventMap[this])childSelector=childSelector.replace(':'+this,'');});childElements=childSelector.match(/([\>\+\~]|(\:not\()?((\w[\-\w]*|\*)|[\.\#]\w[\-\w]*|\:{1,2}\w[\-\w\(\)]*|\[[^\]]*\])+\)?\!?)/gi);if(childElements.length>1){var qDOM;do{qDOM=false;try{child=$(childSelector);}
     5declarations=declarations.replace(/}/g,';}');declarations=declarations.replace(/;/g,' !important;');parsedSelectors='';for(j=-1;++j<selectors.length;){selector=$.trim(selectors[j]);(parsedSelectors.length)&&(parsedSelectors+=",");var splitsel=selector.split('!');if(/!/.test(selector)){var splitsel=selector.split('!');if(splitsel.length>2)
     6splitsel[1]=splitsel.slice(1).join('!');var splitp=splitsel[0].split(/[>~+\s]+/).reverse()[0].split(/[\:]+/);parent=$.trim(splitp[0]);pseudoParents=splitp.slice(1);var splitt=splitsel[1].split(/[>~+\s]+/).reverse()[0].split(/[\:]+/);target=$.trim(splitt[0])||[]._;pseudoTargets=splitt.slice(1);childSelector=selector.replace(/!/g,'').replace('::',':');$(pseudoParents).each(function(){childSelector=childSelector.replace(':'+this,'');});$(pseudoTargets).each(function(){if(eventMap[this.toString()]||pairedEventMap[this.toString()])
     7childSelector=childSelector.replace(':'+this,'');});childElements=childSelector.match(/([\>\+\~]|(\:not\()?((\w[\-\w]*|\*)|[\.\#]\w[\-\w]*|\:{1,2}\w[\-\w\(\)]*|\[[^\]]*\])+\)?\!?)/gi);if(childElements.length>1){var qDOM;do{qDOM=false;try{child=$(childSelector);}
    68catch(err){var ep=':'+$.trim(err.toString().match(/[\w\-]+$/i));if(childSelector.lastIndexOf(ep)>=0){childSelector=childSelector.replace(new RegExp(ep,'g'),'');qDOM=true;}}}while(qDOM);child.each(function(idx){var subject=$(this);var tmpNodes=childElements.slice(0,-1);;var n=$.trim(tmpNodes.pop());do{switch(n){case'>':n=$.trim(tmpNodes.pop());case'*':subject=subject.parent(n);break;case'+':n=$.trim(tmpNodes.pop());subject=subject.prev(n);break;case'~':n=$.trim(tmpNodes.pop());subject=subject.prev();while(subject&&!subject.is(n)){subject=subject.prev();}
    7 break;default:subject=subject.closest(n);break;}}while(subject&&n!=parent&&(n=$.trim(tmpNodes.pop())));if(subject){var id=CLASS+k++,mmpsAddNamespace=function(eType){return eType.split(/[ ]+/).join('.e'+id+' ')+'.e'+id;},toggleFn=function(e){var eid='E#'+evidx++;if(e){if(pairedEventMap[e.type]){$(e.currentTarget).one(mmpsAddNamespace(pairedEventMap[e.type]),{id:e.data.id,subject:$(e.data.subject)},function(oe){$(oe.currentTarget).off(mmpsAddNamespace(pairedEventMap[e.type]));$(oe.data.subject).toggleClass(oe.data.id);});}}
    8 $(e.data.subject).toggleClass(e.data.id);};idx&&(parsedSelectors.length)&&(parsedSelectors+=",");parsedSelectors+='.'+id;var qClass=false;$(pseudoParents).each(function(){var ppNorm=this.replace(/\-/g,'_');if(pseudoElements[ppNorm]){parsedSelectors+=pseudoElements[ppNorm];qClass=true;}else{$(subject).on(mmpsAddNamespace(eventMap[this]||this),{id:id,subject:$(subject)},toggleFn);}});if(pseudoTargets.length){var orgChild=$(this);$(pseudoTargets).each(function(){var pt=this.split(/(?:\(|\))/g);var ptNorm=pt[0].replace(/\-/g,'_');var ptParam=stateMap[ptNorm]+(pt[1]?'('+pt[1]+')':'');if(pseudoElements[ptNorm]){}else if(eventMap[this]){$(orgChild).on(mmpsAddNamespace(eventMap[this]),{id:id,subject:$(subject)},toggleFn);qClass=false;}else if(stateMap[ptNorm]){qClass=true;}else{$(orgChild).on(mmpsAddNamespace(this.toString()),{id:id,subject:$(subject)},toggleFn);qClass=false;}});}else if(!pseudoParents.length){qClass=true;}
     9break;default:subject=subject.closest(n);break;}}while(subject&&n!=parent&&(n=$.trim(tmpNodes.pop())));if(subject){var id=CLASS+k++,addNamespace=function(eType){return eType.split(/[ ]+/).join('.e'+id+' ')+'.e'+id;},getPseudoElement=function(ppNorm){return pseudoElements[ppNorm.replace(/\-/g,'_')];},getPseudoState=function(ppNorm){var ps=ppNorm.split('(');if(stateMap[ps[0].replace(/\-/g,'_')])
     10return stateMap[ps[0].replace(/\-/g,'_')]+ps.slice(1).join('(');return false;},getPseudoEvent=function(ppNorm){if(eventMap[ppNorm])
     11return eventMap[ppNorm];else if(pairedEventMap[ppNorm])
     12return ppNorm;return false;},toggleFn=function(e){var eid='E#'+evidx++;if(e){if(pairedEventMap[e.type]){$(e.currentTarget).bind(addNamespace(pairedEventMap[e.type]),{id:e.data.id,subject:$(e.data.subject)},function(oe){$(oe.currentTarget).unbind(addNamespace(pairedEventMap[e.type]));$(oe.data.subject).toggleClass(oe.data.id);});}}
     13$(e.data.subject).toggleClass(e.data.id);};checkVisitedLink=function(e){var eid='E#'+evidx++,qClass=false;if(e){try{if($(e.currentTarget).is(':visited')){if(!$(e.data.subject).hasClass(e.data.id)){qClass=true;}}else{if($(e.data.subject).hasClass(e.data.id)){qClass=true;}}}
     14catch(err){if($(e.data.subject).hasClass(e.data.id)){qClass=true;}}}
     15if(qClass){$(e.data.subject).toggleClass(e.data.id);}};idx&&(parsedSelectors.length)&&(parsedSelectors+=",");parsedSelectors+='.'+id;var qClass=false;$(pseudoParents).each(function(){var pe;if(pe=getPseudoElement(this.toString())){parsedSelectors+=pe;qClass=true;}else if(pe=getPseudoEvent(this.toString())){$(subject).bind(addNamespace(pe),{id:id,subject:$(subject)},toggleFn);qClass=false;}else if(pe=getPseudoState(this.toString())){parsedSelectors+=pe;qClass=true;}else{}});if(pseudoTargets.length){var orgChild=$(this);$(pseudoTargets).each(function(){var pe;if(pe=getPseudoElement(this.toString())){}else if(this.toString()=='visited'&&$(orgChild).prop('tagName')=='A'){try{qClass=$(orgChild).is(':visited');}
     16catch(err){qClass=false;}
     17$(orgChild).bind(addNamespace('click focus blur'),{id:id,subject:$(subject)},checkVisitedLink);}else if(pe=getPseudoEvent(this.toString())){$(orgChild).bind(addNamespace(pe),{id:id,subject:$(subject)},toggleFn);qClass=false;}else if(pe=getPseudoState(this.toString())){qClass=true;}else{}});}else if(!pseudoParents.length){qClass=true;}
    918if(qClass){$(subject).toggleClass(id);}}});}}else{child=$(selector);if(child.length)parsedSelectors+=selector;}}
    1019if(parsedSelectors.length){parsedSelectors+=' '+declarations;parsed+=parsedSelectors+"\n";}}
     
    1322if(M[1]==='Chrome'){tem=ua.match(/\b(OPR|Edge)\/(\d+)/);if(tem!=null)
    1423return tem.slice(1).join(' ').replace('OPR','Opera');}
    15 M=M[2]?[M[1],M[2]]:[navigator.appName,navigator.appVersion,'-?'];if((tem=ua.match(/version\/(\d+)/i))!=null)M.splice(1,1,tem[1]);return{'browser':M[0],'version':M[1]};;})();if(navigator.browserInfo.browser=="MSIE"&&navigator.browserInfo.version<=8){pseudoElements={after:':after',before:':before',first_letter:':first-letter',first_line:':first-line',selection:':selection'};stateMap={disabled:':disabled',empty:':empty',enabled:':enabled',invalid:':invalid',optional:':optional',required:':required',target:':target',valid:':valid'};}
     24M=M[2]?[M[1],M[2]]:[navigator.appName,navigator.appVersion,'-?'];if((tem=ua.match(/version\/(\d+)/i))!=null)M.splice(1,1,tem[1]);return{'browser':M[0],'version':M[1]};;})();if(navigator.browserInfo.browser=="MSIE"&&navigator.browserInfo.version<=8){pseudoElements={after:':after',before:':before',first_letter:':first-letter',first_line:':first-line',selection:':selection'};stateMap={active:':active',disabled:':disabled',empty:':empty',enabled:':enabled',invalid:':invalid',lang:':lang',link:':link',not:':not',optional:':optional',required:':required',target:':target',valid:':valid',visited:':visited'};}
    1625$('link[rel="stylesheet"],style').each(function(i){if($(this).is('link')){var href=$(this).attr('href');$.ajax({type:'GET',url:href,dataType:'text'}).done(function(css){parse(css);}).fail(function(){});}else{parse($(this).text());}});});
  • militant-moderates-css-parent-selector-mmps/trunk/mmParentSelector.php

    r1188234 r1188826  
    22/**
    33 * @package militant-moderates-css-parent-selector-mmps
    4  * @version 1.1.3
     4 * @version 1.1.4
    55 */
    66/*
     
    88Plugin URI: http://www.militantmoderates.org/mmps-quick-start/
    99Description: Adds CSS "Parent Selector" support to your Theme. Apply your CSS Style to Parent/Sibling elements not just the Selected element.
    10 Version: 1.1.3
     10Version: 1.1.4
    1111Author: MM Techmaster
    1212Author URI: https://profiles.wordpress.org/mmtechmaster
     
    3939 *-------------------------------------------------------------------------------------*/
    4040define( 'MMPS_SCRIPT_DEV', 0 );                     // set as above: 0, 1, 2
     41define( 'MMPS_SCRIPT_VERSION', '1.1.4' );           // set to script version number as in header
    4142
    4243function mmps_js() {
     
    5152        // the .dev.js version is the working copy with full debugging included
    5253        // it is NOT included in the standard distribution, so protect against attempts to use it
    53         wp_enqueue_script( 'mmps_js', plugins_url( 'js/mmParentSelector.dev.js', __FILE__ ), array( 'jquery' ) );
     54        wp_enqueue_script( 'mmps_js', plugins_url( 'js/mmParentSelector.dev.js', __FILE__ ), array( 'jquery' ), MMPS_SCRIPT_VERSION );
    5455
    5556    } elseif ( MMPS_SCRIPT_DEV != 1 ) {
    5657        // Either in full DEBUG mode but not allowed (not an admin) or FULL version NOT specified explicitly ...
    5758        // the .min.js version is stripped of all debugging code and minified
    58         wp_enqueue_script( 'mmps_js', plugins_url( 'js/mmParentSelector.min.js', __FILE__ ), array( 'jquery' ) );
     59        wp_enqueue_script( 'mmps_js', plugins_url( 'js/mmParentSelector.min.js', __FILE__ ), array( 'jquery' ), MMPS_SCRIPT_VERSION );
    5960
    6061    } else {
    6162        // the .js version is stripped of debugging but is NOT minified
    62         wp_enqueue_script( 'mmps_js', plugins_url( 'js/mmParentSelector.js', __FILE__ ), array( 'jquery' ) );
     63        wp_enqueue_script( 'mmps_js', plugins_url( 'js/mmParentSelector.js', __FILE__ ), array( 'jquery' ), MMPS_SCRIPT_VERSION );
    6364
    6465    }
  • militant-moderates-css-parent-selector-mmps/trunk/readme.txt

    r1188234 r1188826  
    3434
    3535== Changelog ==
     36= 1.1.4 (in development) =
     37* Massive rework under the event handling hood; switching to bind/unbind instead of on/off
     38* Handle <a> link elements differently because of the :link and :visited behavioral differences
     39* Added error handling around calls into the DOM that might fail under older browsers
     40 * Changes in progress - Stay tuned for details
     41
    3642= 1.1.3 =
    3743* Fixed issue that caused wrong Class to be removed at the end of a Paired Event: mouseover/mouseout for example
Note: See TracChangeset for help on using the changeset viewer.