Changeset 1188826
- Timestamp:
- 06/28/2015 03:21:05 AM (11 years ago)
- Location:
- militant-moderates-css-parent-selector-mmps/trunk
- Files:
-
- 5 edited
-
css/mmParentSelector.css (modified) (2 diffs)
-
js/mmParentSelector.js (modified) (13 diffs)
-
js/mmParentSelector.min.js (modified) (2 diffs)
-
mmParentSelector.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
militant-moderates-css-parent-selector-mmps/trunk/css/mmParentSelector.css
r1188234 r1188826 1 1 /** 2 2 * @package militant-moderates-css-parent-selector-mmps 3 * @version 1.1. 33 * @version 1.1.4 4 4 */ 5 5 /* … … 7 7 Plugin URI: http://www.militantmoderates.org/mmps-quick-start/ 8 8 Description: 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. 39 Version: 1.1.4 10 10 Author: MM Techmaster 11 11 Author URI: https://profiles.wordpress.org/mmtechmaster -
militant-moderates-css-parent-selector-mmps/trunk/js/mmParentSelector.js
r1188234 r1188826 1 1 /** 2 2 * @package militant-moderates-css-parent-selector-mmps 3 * @version 1.1. 33 * @version 1.1.4 4 4 */ 5 5 /* … … 7 7 Plugin URI: http://www.militantmoderates.org/mmps-quick-start/ 8 8 Description: 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. 39 Version: 1.1.4 10 10 Author: MM Techmaster 11 11 Author URI: https://profiles.wordpress.org/mmtechmaster … … 35 35 36 36 eventMap = { 37 abort: 'abort', 37 38 active: 'focusin', 39 click: 'click', 40 dblclick: 'dblclick', 38 41 focus: 'focusin', 42 focusout: 'focusout', 39 43 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', 40 56 }, 41 57 42 58 pairedEventMap = { 43 mousedown: 'mouseup mouseout mouseleave',44 59 focusin: 'focusout', 45 60 keydown: 'keyup', 61 mousedown: 'mouseup mouseout mouseleave', 46 62 mouseenter: 'mouseleave', 47 63 mouseover: 'mouseout', … … 114 130 115 131 // parse Selector portion of Style 116 selectors = $.trim(style.split('{')[0]).split( ',');132 selectors = $.trim(style.split('{')[0]).split( /\s*,\s*/ ); 117 133 118 134 // 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, '' ) + '}'; 120 136 121 137 // skip empty declarations … … 135 151 (parsedSelectors.length) && (parsedSelectors += ","); 136 152 153 // Split the selector on the '!' and save results 154 var splitsel = selector.split('!'); 155 137 156 if (/!/.test(selector) ) { 138 157 // Split the selector on the '!' and save results 139 158 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('!'); 140 163 141 164 // Parse Parent from Selector … … 143 166 144 167 // parse Parent and ALL Pseudo Parents :before :after :hover :click etc. 145 parent = $.trim(splitp[0]); 146 pseudoParents = splitp.slice(1); // get all Pseudo Parents168 parent = $.trim(splitp[0]); // first member is Parent Element 169 pseudoParents = splitp.slice(1); // all remaining members are Pseudo Classes or Elements 147 170 148 171 // parse Target from Selector … … 154 177 155 178 // Build Child Selector - Same as Selector but without '!' 179 // Remove '!' Parent Selector designator and convert double colons to single 156 180 childSelector = selector.replace(/!/g, '').replace('::', ':'); 181 157 182 // Remove ALL Parent Pseudo Classes and Pseudo Elements 158 $(pseudoParents).each(function( x) {183 $(pseudoParents).each(function() { 159 184 childSelector = childSelector.replace( ':' + this, '' ); 160 185 }); 161 186 // 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, '' ); 164 190 }); 165 191 … … 229 255 var id = CLASS + k++, 230 256 231 mmpsAddNamespace = function(eType) {257 addNamespace = function( eType ) { 232 258 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; 233 278 }, 234 279 … … 238 283 // if this is a paired event then build a reverse handler 239 284 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) { 241 286 // 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] ) ); 243 288 // Then toggle the Class on the Subject element 244 289 $(oe.data.subject).toggleClass(oe.data.id); … … 251 296 }; 252 297 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 253 326 idx && (parsedSelectors.length) && (parsedSelectors += ","); 254 327 parsedSelectors += '.' + id; … … 259 332 // Loops through the Pseudo Parents and apply those that are needed 260 333 $(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; 264 346 qClass = true; // apply class later .. maybe 265 347 } 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 269 349 } 270 350 }); … … 275 355 $(pseudoTargets).each(function() { 276 356 // 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 ); 288 375 // Do not apply Class to the subject - Event will apply it 289 376 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 291 379 // A normal or special Parameterized Pseudo Class State 292 380 qClass = true; 293 381 } else { 294 382 // 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;297 383 } 298 384 }); … … 354 440 355 441 stateMap = { 442 active: ':active', 356 443 disabled: ':disabled', 357 444 empty: ':empty', 358 445 enabled: ':enabled', 359 446 invalid: ':invalid', 447 lang: ':lang', 448 link: ':link', 449 not: ':not', 360 450 optional: ':optional', 361 451 required: ':required', 362 452 target: ':target', 363 valid: ':valid' 453 valid: ':valid', 454 visited: ':visited' 364 455 }; 365 456 } -
militant-moderates-css-parent-selector-mmps/trunk/js/mmParentSelector.min.js
r1188234 r1188826 1 1 2 jQuery(document).ready(function($){var evidx=0,k=0,i,j,CLASS='mmPpSsPrEfIx',eventMap={a ctive:'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;}2 jQuery(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++) 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(/\s*,\s*/);declarations='{'+style.split(/\{|\}/)[1].replace(/^\s+|\s+$[\t\n\r]*/g,'')+'}';if(declarations==='{}'){continue;} 4 4 if(!/;}$/.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);} 5 declarations=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) 6 splitsel[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()]) 7 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);} 6 8 catch(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;} 9 break;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,'_')]) 10 return stateMap[ps[0].replace(/\-/g,'_')]+ps.slice(1).join('(');return false;},getPseudoEvent=function(ppNorm){if(eventMap[ppNorm]) 11 return eventMap[ppNorm];else if(pairedEventMap[ppNorm]) 12 return 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;}}} 14 catch(err){if($(e.data.subject).hasClass(e.data.id)){qClass=true;}}} 15 if(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');} 16 catch(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;} 9 18 if(qClass){$(subject).toggleClass(id);}}});}}else{child=$(selector);if(child.length)parsedSelectors+=selector;}} 10 19 if(parsedSelectors.length){parsedSelectors+=' '+declarations;parsed+=parsedSelectors+"\n";}} … … 13 22 if(M[1]==='Chrome'){tem=ua.match(/\b(OPR|Edge)\/(\d+)/);if(tem!=null) 14 23 return 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'};}24 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={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'};} 16 25 $('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 2 2 /** 3 3 * @package militant-moderates-css-parent-selector-mmps 4 * @version 1.1. 34 * @version 1.1.4 5 5 */ 6 6 /* … … 8 8 Plugin URI: http://www.militantmoderates.org/mmps-quick-start/ 9 9 Description: 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. 310 Version: 1.1.4 11 11 Author: MM Techmaster 12 12 Author URI: https://profiles.wordpress.org/mmtechmaster … … 39 39 *-------------------------------------------------------------------------------------*/ 40 40 define( 'MMPS_SCRIPT_DEV', 0 ); // set as above: 0, 1, 2 41 define( 'MMPS_SCRIPT_VERSION', '1.1.4' ); // set to script version number as in header 41 42 42 43 function mmps_js() { … … 51 52 // the .dev.js version is the working copy with full debugging included 52 53 // 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 ); 54 55 55 56 } elseif ( MMPS_SCRIPT_DEV != 1 ) { 56 57 // Either in full DEBUG mode but not allowed (not an admin) or FULL version NOT specified explicitly ... 57 58 // 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 ); 59 60 60 61 } else { 61 62 // 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 ); 63 64 64 65 } -
militant-moderates-css-parent-selector-mmps/trunk/readme.txt
r1188234 r1188826 34 34 35 35 == 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 36 42 = 1.1.3 = 37 43 * 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.