User:Asqueella/JEP 107: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
Line 25: Line 25:
   ]
   ]
});
});
</pre>
==== Page Mods Method: <i>add</i> ====
<b>Arguments:</b>
#<b>type</b> - (<i>string</i>) The type of modifier being added. Can be 'include', 'exclude', 'style', or 'script'
#<b>data</b> -
#* include: (<i>array</i>) an array of URL strings to apply mods to
#* exclude: (<i>array</i>) an array of URL strings to skip when modding
#* style: (<i>array</i>) an array of style or resource strings
#* script: (<i>function</i>) an array of functions or resource strings
<b>Returns:</b>
The Page Mods instance
<b>Notes:</b>
Modifications passed to the Page Mods instance with this method will be added, and persist, on open and future documents matching all of the URL(s) currently on the 'include' white-list.
<b>Examples:</b>
<pre class="brush:js;">
myMods.add('include', ['*.digg.com']);
myMods.add('exclude', ['http://labs.digg.com/*']);
myMods.add('style', ['body: { background: #ffffff; font-family: Trebuchet MS; } span.details { font-size: 7px; }']);
// Creating a function reference
var pageLog = function(){
  console.log('I just logged a message with Page Mods!');
}
myMods.add('script', pageLog);
</pre>
==== FUTURE ADDITION: Page Mods Method: <i>remove</i> ====
<b>Arguments:</b>
#<b>type</b> - (<i>string</i>) The type of modifier being added. Can be 'include', 'exclude', 'style', or 'script'
#<b>data</b> -
#* include: (<i>array</i>) an array of URL strings to apply mods to
#* exclude: (<i>array</i>) an array of URL strings to skip when modding
#* style: (<i>array</i>) an array of style or resource strings
#* script: (<i>function</i>) an array of functions or resource strings
<b>Returns:</b>
The Page Mods instance
<b>Examples:</b>
<pre class="brush:js;">
myMods.remove('include', '*.google.com');
myMods.remove('exclude', 'http://labs.digg.com/*');
myMods.remove('style', [
  'body { background; font-family; } span.details{}'  //This would remove all styles for the selector
]);
myMods.remove('script', pageLog);
</pre>
==== FUTURE ADDITION: Page Mods Method: <i>empty</i> ====
<b>Arguments:</b>
#<b>type</b> - (<i>string</i>) The type of modifier being added. Can be 'include', 'exclude', 'style', or 'script'
<b>Returns:</b>
The Page Mods instance
<b>Examples:</b>
<pre class="brush:js;">
myMods.empty('include');
</pre>
</pre>


Confirmed users
162

edits

Navigation menu