MCPcopy
hub / github.com/google/tamperchrome / createIgnoreOptions

Function createIgnoreOptions

v1/extension/tamper.js:379–414  ·  view source on GitHub ↗
(section, options)

Source from the content-addressed store, hash-verified

377
378// for creating sub-options checkboxes
379var createIgnoreOptions = function(section, options) {
380 if (!options) {
381 options = [
382 {type: 'ignore-main_frame', text: 'Ignore browser requests'},
383 {type: 'ignore-sub_frame', text: 'Ignore subframes'},
384 {type: 'ignore-script', text: 'Ignore scripts'},
385 {type: 'ignore-stylesheet', text: 'Ignore stylesheets'},
386 {type: 'ignore-image', text: 'Ignore images'},
387 {type: 'ignore-xmlhttprequest', text: 'Ignore XMLHttpRequests'},
388 {type: 'ignore-object', text: 'Ignore objects (flash, etc)'},
389 {type: 'ignore-other', text: 'Ignore other (fonts, favicons, etc)'}
390 ];
391 }
392 var result = document.createElement('div');
393 for (var i=0; i<options.length; i++) {
394 var lbl = document.createElement('label');
395 var chk = document.createElement('input');
396 lbl.appendChild(chk);
397 lbl.insertAdjacentText('beforeend', options[i].text);
398 chk.setAttribute('type', 'checkbox');
399 chk.setAttribute('data-number', i);
400 chk.onchange = function(e) {
401 var message = {
402 tabId: tabId,
403 key: "subconf",
404 parent: section,
405 option: options[this.getAttribute('data-number')].type,
406 value: this.checked
407 };
408 port.postMessage(message);
409 }
410 //port.postMessage = message;
411 result.appendChild(lbl);
412 }
413 return result;
414}
415
416

Callers 1

tamper.jsFile · 0.85

Calls 1

postMessageMethod · 0.80

Tested by

no test coverage detected