Skip to content
Snippets Groups Projects
Commit e72fd329 authored by Recolic K's avatar Recolic K
Browse files

dir structure

parent f713fe05
No related branches found
No related tags found
No related merge requests found
Showing
with 8780 additions and 0 deletions
This diff is collapsed.
.title{
color: #008CBA;
}
.select_field{
font-size: 14px;
height: 30px;
}
.input_field_small{
font-size: 14px;
height: 30px;
border: 1px solid #AAAAAA;
border-radius: 3px;
width: 170px;
}
.input_field_medium{
font-size: 14px;
height: 30px;
border: 1px solid #AAAAAA;
border-radius: 3px;
width: 230px;
}
.input_field_large{
font-size: 14px;
height: 30px;
border: 1px solid #AAAAAA;
border-radius: 3px;
width: 340px;
}
.input_url {
border: none;
border-bottom: 1px solid #AAAAAA;
width:600px;
}
.standard_table {
width:1130px;
}
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Simple Modify Headers</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="config.css">
<link rel="stylesheet" media="screen and (max-width: 1200px) and (min-width: 1001px)" href="config_medium_screen.css" />
<link rel="stylesheet" media="screen and (max-width: 1000px)" href="config_small_screen.css" />
</head>
<body>
<div class="container">
<!-- MAIN SCREEN -->
<div id="main_screen" style="text-align:center">
<table class="standard_table">
<tr>
<td style="text-align:left"><h2 class="title"> SIMPLE MODIFY HEADERS </h2> </td>
<td style="text-align:right"> <img id="start_img" src="img/start.png" alt="start/stop" style="float:right;vertical-align:top"> </img> </td>
</tr>
</table>
<br/>
<br/>
<table class="standard_table">
<tr>
<td style="text-align:left" > <strong> Url Patterns* : </strong> <input id="targetPage" class="form_control input_url" type="text" value=""> </td>
<td style="text-align:right">
<button type="button" id="export_button" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-export"></span> Export
</button>
<button type="button" id="import_button" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-import"></span> Import
</button>
<button type="button" id="parameters_button" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-cog"></span> Parameters
</button>
</td>
</tr>
</table>
<br/> <br/>
<table id="table_config" class="table table-condensed " >
<thead>
<tr id="config_table_head">
<th> When URL contains </th>
<th> Action </th>
<th> Header Field Name </th>
<th> Header Field Value </th>
<th> Comment </th>
<th> Apply on </th>
<th> Status </th>
<th> </th>
<th> </th>
<th> </th>
</tr>
</thead>
<tbody id="config_tab">
</tbody>
</table>
<table class="standard_table"> <tr><td style="text-align:center">
<button type="button" id="add_button" class="btn btn-primary btn-sm" style="width:100px">
<span class="glyphicon glyphicon-plus"></span> New line
</button>
<button type="button" id="save_button" class="btn btn-primary btn-sm" style="width:100px">
<span class="glyphicon glyphicon-save"></span> Save
</button>
</td></tr></table>
<br/>
<table class="standard_table">
<tr>
<td style="text-align:left" >
<em style="font-size:10pt"> * Information on URL patterns can be found <a href="https://developer.chrome.com/extensions/match_patterns" target="_blank"> here.</a> <br> An empty string on the field will select all URLs. It's possible to select multiple URL patterns using semicolon (;) separator </em>
</td>
<td style="text-align:right">
<a href="https://github.com/didierfred/SimpleModifyHeaders/tree/v1.7.0" target="_blank"> <span class="glyphicon glyphicon-question-sign"></span> About </a>
</td>
</tr>
</table>
</div>
<!-- PARAMETERS SCREEN -->
<div id="parameters_screen" hidden>
<h2 class="title"> SIMPLE MODIFY HEADERS </h2>
<strong> Parameters : </strong>
<br/>
<br/>
<input type="checkbox" id="debug_mode"> Debug mode </input>
<br/>
<input type="checkbox" id="show_comments"> Show comments </input>
<br/>
<input type="checkbox" id="use_url_contains"> Filter URL per rules </input>
<br/>
<br/>
<a href="#" id="exit_parameters_screen_button" class="btn btn-primary btn-sm" style="width:100px">
<span class="glyphicon glyphicon-step-backward"></span> Back
</a>
</div>
<iframe id="download" title="hidden_download_frame" width="0" height="0" style="border:none;">
</iframe>
<br/>
<script type="text/javascript" src="config.js"> </script>
</div>
</body>
</html>
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @author didierfred@gmail.com
*/
let line_number;
let started;
let show_comments;
let use_url_contains;
let input_field_style;
window.onload = function() {
initConfigurationPage();
}
function initConfigurationPage() {
initGlobalValue();
// load configuration from local storage
loadFromBrowserStorage(['config'],function (result) {
config = JSON.parse(result.config);
if (config.debug_mode) document.getElementById("debug_mode").checked = true;
if (typeof config.show_comments === 'undefined') document.getElementById("show_comments").checked = true;
else if (config.show_comments) document.getElementById("show_comments").checked = true;
else show_comments=false;
if (config.use_url_contains) {
document.getElementById("use_url_contains").checked = true;
use_url_contains=true;
}
for (let to_add of config.headers) appendLine(to_add.url_contains,to_add.action,to_add.header_name,to_add.header_value,to_add.comment,to_add.apply_on,to_add.status);
document.getElementById('save_button').addEventListener('click',function (e) {saveData();});
document.getElementById('export_button').addEventListener('click',function (e) {exportData();});
document.getElementById('import_button').addEventListener('click',function (e) {importData(e);});
document.getElementById('parameters_button').addEventListener('click',function (e) {showParametersScreen();});
document.getElementById('add_button').addEventListener('click',function (e) {appendLine("","add","-","-","","req","on");});
document.getElementById('start_img').addEventListener('click',function (e) {startModify();});
document.getElementById('targetPage').value=config.target_page;
checkTargetPageField();
document.getElementById('targetPage').addEventListener('keyup',function (e) {checkTargetPageField();});
document.getElementById('exit_parameters_screen_button').addEventListener('click',function (e) {hideParametersScreen();});
loadFromBrowserStorage(['started'], function (result) {
started = result.started;
if (started==="on") document.getElementById("start_img").src = "img/stop.png";
});
document.getElementById('show_comments').addEventListener('click',function (e) {showCommentsClick();});
document.getElementById('use_url_contains').addEventListener('click',function (e) {useUrlContainsClick();});
reshapeTable();
});
}
function initGlobalValue()
{
line_number = 1;
started = "off";
show_comments = true;
use_url_contains = false;
input_field_style="form_control input_field_small";
}
function loadFromBrowserStorage(item,callback_function) {
chrome.storage.local.get(item, callback_function);
}
function storeInBrowserStorage(item,callback_function) {
chrome.storage.local.set(item,callback_function);
}
function log(message) {
console.log(new Date() + " SimpleModifyHeader : " + message);
}
/** PARAMETERS SCREEN MANAGEMENT **/
function showParametersScreen() {
document.getElementById('main_screen').hidden=true;
document.getElementById('parameters_screen').hidden=false;
}
function hideParametersScreen() {
document.getElementById('main_screen').hidden=false;
document.getElementById('parameters_screen').hidden=true;
}
function showCommentsClick() {
if (document.getElementById('show_comments').checked) show_comments = true;
else show_comments = false;
reshapeTable();
}
function useUrlContainsClick() {
if (document.getElementById('use_url_contains').checked) use_url_contains = true;
else use_url_contains = false;
reshapeTable();
}
/** END PARAMETERS SCREEN MANAGEMENT **/
/**
* Add a new configuration line on the UI
**/
function appendLine(url_contains,action,header_name,header_value,comment,apply_on,status) {
let html = `
<td ${use_url_contains ? '' : ' hidden'}>
<input class="${input_field_style}" id="url_contains${line_number}" />
</td>
<td>
<select class="form_control select_field" id="select_action${line_number}"> disable="false">
<option value="add">Add</option>
<option value="modify">Modify</option>
<option value="delete">Delete</option>
<option value="cookie_add_or_modify">Cookie Add/Modify</option>
<option value="cookie_delete">Cookie Delete</option>
</select>
</td>
<td>
<input class="${input_field_style}" id="header_name${line_number}" />
</td>
<td>
<input class="${input_field_style}" id="header_value${line_number}" />
</td>
<td${show_comments ? '' : ' hidden'}>
<input class="${input_field_style}" id="comment${line_number}" />
</td>
<td>
<select class="form_control select_field" id="apply_on${line_number}">
<option value="req">Request</option>
<option value="res">Response</option>
</select>
</td>
<td>
<button type="button" class="btn btn-primary btn-sm" title="Activate/deactivate rule" id="activate_button${line_number}">ON <span class="glyphicon glyphicon-ok"></span></button>
</td>
<td>
<button type="button" class="btn btn-default btn-sm" title="Move line up" id="up_button${line_number}">
<span class="glyphicon glyphicon-arrow-up"></span>
</button>
</td>
<td>
<button type="button" class="btn btn-default btn-sm" title="Move line down" id="down_button${line_number}">
<span class="glyphicon glyphicon-arrow-down"></span>
</button>
</td>
<td>
<button type="button" class="btn btn-default btn-sm" title="Delete line" id="delete_button${line_number}">
<span class="glyphicon glyphicon-trash"></span>
</button>
</td>
`;
let newTR = document.createElement("tr");
newTR.id="line" + line_number;
newTR.innerHTML = html;
document.getElementById("config_tab").appendChild(newTR);
document.getElementById("select_action"+line_number).value = action;
document.getElementById("apply_on"+line_number).value = apply_on;
document.getElementById("url_contains"+line_number).value = url_contains;
document.getElementById("header_name"+line_number).value = header_name;
document.getElementById("header_value"+line_number).value = header_value;
document.getElementById("comment"+line_number).value = comment;
const line_number_to_modify = line_number;
document.getElementById('activate_button'+line_number).addEventListener('click',function (e) {switchActivateButton(line_number_to_modify)});
setButtonStatus(document.getElementById('activate_button'+line_number),status);
document.getElementById('delete_button'+line_number).addEventListener('click',function (e) {deleteLine(line_number_to_modify)});
document.getElementById('up_button'+line_number).addEventListener('click',function (e) {invertLine(line_number_to_modify,line_number_to_modify-1)});
document.getElementById('down_button'+line_number).addEventListener('click',function (e) {invertLine(line_number_to_modify,line_number_to_modify+1)});
line_number++;
}
/** ACTIVATE BUTTON MANAGEMENT **/
function setButtonStatus(button,status) {
if (status==="on") {
button.className="btn btn-primary btn-sm";
button.innerHTML="ON <span class=\"glyphicon glyphicon-ok\"></span>";
}
else {
button.className="btn btn-default btn-sm";
button.innerHTML="OFF <span class=\"glyphicon glyphicon-ban-circle\"></span>";
}
}
function getButtonStatus(button) {
if (button.className==="btn btn-primary btn-sm") return "on";
return "off";
}
function switchActivateButton(button_number) {
const activate_button = document.getElementById("activate_button"+button_number);
// Button is ON
if (getButtonStatus(activate_button)==="on") setButtonStatus(activate_button,"off");
// Button is OFF
else setButtonStatus(activate_button,"on");
}
/** END ACTIVATE BUTTON MANAGEMENT **/
function reshapeTable() {
let th_elements = document.querySelectorAll("#config_table_head th");
let tr_elements = document.querySelectorAll("#config_tab tr");
if (show_comments) {
if (use_url_contains) input_field_style = "form_control input_field_small";
else input_field_style = "form_control input_field_medium";
}
else {
if (use_url_contains) input_field_style = "form_control input_field_medium";
else input_field_style = "form_control input_field_large";
}
for (let i=0;i<tr_elements.length;i++) {
tr_elements[i].children[4].children[0].className=input_field_style;
tr_elements[i].children[4].hidden = (!show_comments);
tr_elements[i].children[3].children[0].className=input_field_style;
tr_elements[i].children[2].children[0].className=input_field_style;
tr_elements[i].children[0].children[0].className=input_field_style;
tr_elements[i].children[0].hidden = (!use_url_contains);
}
th_elements[4].hidden = (!show_comments);
th_elements[0].hidden = (!use_url_contains);
}
/**
* Create a JSON String representing the configuration data
*
**/
function create_configuration_data() {
let tr_elements = document.querySelectorAll("#config_tab tr");
let headers = [];
let debug_mode=false;
let show_comments=false;
for (let i=0;i<tr_elements.length;i++) {
const url_contains = tr_elements[i].children[0].children[0].value;
const action = tr_elements[i].children[1].children[0].value;
const header_name = tr_elements[i].children[2].children[0].value;
const header_value = tr_elements[i].children[3].children[0].value;
const comment = tr_elements[i].children[4].children[0].value;
const apply_on = tr_elements[i].children[5].children[0].value;
const status = getButtonStatus(tr_elements[i].children[6].children[0]);
headers.push({url_contains:url_contains,action:action,header_name:header_name,header_value:header_value,comment:comment,apply_on:apply_on,status:status});
}
if (document.getElementById("debug_mode").checked) debug_mode=true;
if (document.getElementById("show_comments").checked) show_comments=true;
if (document.getElementById("use_url_contains").checked) use_url_contains=true;
let to_export = {format_version:"1.2",target_page:document.getElementById('targetPage').value,headers:headers,
debug_mode:debug_mode,show_comments:show_comments,use_url_contains:use_url_contains};
return JSON.stringify(to_export);
}
/**
* check if url pattern is valid , if not set the font color to red
**/
function checkTargetPageField() {
if (isTargetValid(document.getElementById('targetPage').value)) document.getElementById('targetPage').style.color="black";
else document.getElementById('targetPage').style.color="red";
}
/**
* check if url patterns are valid
**/
function isTargetValid(target) {
if (target==="") return true;
if (target===" ") return true;
if (target==="*") return true;
let targets=target.split(";");
for (let i in targets) {
if (!targets[i].match("(http|https|[\*]):\/\/([\*][\.][^\*]*|[^\*]*|[\*])\/")) return false;
}
return true;
}
/**
* save the data to the local storage and restart modify header
* show a warning if url patterns are invalid
**/
function saveData() {
if (!isTargetValid(document.getElementById('targetPage').value)) alert("Warning: Url patterns are invalid");
storeInBrowserStorage({config:create_configuration_data()},function() {
chrome.runtime.sendMessage("reload");
});
return true;
}
/**
* If url pattern is valid save the data in a file
**/
function exportData() {
// Create file data
let to_export= create_configuration_data();
// Create file to save
let a = document.createElement('a');
a.href = 'data:attachment/json,' + encodeURIComponent(to_export);
a.target = 'download';
a.download = 'SimpleModifyHeader.conf';
// use iframe "download" to put the link (in order not to be redirect in the parent frame)
let myf = document.getElementById("download");
myf = myf.contentWindow.document || myf.contentDocument;
myf.body.appendChild(a);
a.click();
}
/**
* Choose a file and import data from the choosen file
*
**/
function importData(evt) {
// create an input field in the iframe
if (window.confirm("This will erase your actual configuration, do you want to continue ?")) {
let input = document.createElement("input");
input.type="file";
input.addEventListener('change', readSingleFile, false);
let myf = document.getElementById("download");
myf = myf.contentWindow.document || myf.contentDocument;
myf.body.appendChild(input);
input.click();
}
}
/**
* Import configuration from a file
*
*
*
**/
function readSingleFile(e) {
let file = e.target.files[0];
if (!file) return;
let reader = new FileReader();
reader.onload = function(e) {
loadConfiguration(e.target.result);
}
reader.readAsText(file);
}
/**
* Load configuration from a string
* If format is not recognized , try modify header add-an file format
**/
function loadConfiguration(configuration) {
let config="";
try {
config = JSON.parse(configuration);
// check file format
if (config.format_version) {
if (config.format_version==="1.0") config = convertConfigurationFormat1dot0ToCurrentFormat(config);
else if (config.format_version==="1.1") config = convertConfigurationFormat1dot1ToCurrentFormat(config);
}
else {
if (config[0].action) config = convertHistoricalModifyHeaderFormatToCurrentFormat (config);
else {
alert("Invalid file format");
return;
}
}
}
catch(error) {
console.log(error);
alert("Invalid file format");
return;
}
// store the conf in the local storage
storeInBrowserStorage({config:JSON.stringify(config)},function() {
// load the new conf
reloadConfigPage();
});
}
function convertConfigurationFormat1dot0ToCurrentFormat(config) {
config.format_version="1.2";
for (let line of config.headers) {
line.apply_on="req";
line.url_contains="";
}
config.debug_mode=false;
config.show_comments=true;
config.use_url_contains=false;
return config;
}
function convertConfigurationFormat1dot1ToCurrentFormat(config) {
config.format_version="1.2";
for (let line of config.headers) line.url_contains="";
config.show_comments=true;
config.use_url_contains=false;
return config;
}
/**
* Historical Modify header add-on file format : array of {action,name,value,comment,enabled}
**/
function convertHistoricalModifyHeaderFormatToCurrentFormat(config) {
let headers = [];
for (let line_to_load of config) {
var enabled = "off";
if (line_to_load.enabled) enabled = "on";
if (line_to_load.action==="Filter") line_to_load.action="delete";
headers.push({url_contains:"",action:line_to_load.action.toLowerCase(),header_name:line_to_load.name,
header_value:line_to_load.value,comment:line_to_load.comment,apply_on:"req",status:enabled});
}
return {format_version:"1.2",target_page:"",headers:headers,debug_mode:false,show_comments:true,use_url_contains:false};
}
function reloadConfigPage() {
chrome.runtime.sendMessage("reload");
document.location.href="config.html";
}
/**
* Delete a configuration line on the UI
**/
function deleteLine(line_number_to_delete) {
if (line_number_to_delete !== line_number) {
for (let i=line_number_to_delete;i<line_number-1;i++) {
const j = i+1;
document.getElementById("select_action"+i).value = document.getElementById("select_action"+j).value;
document.getElementById("url_contains"+i).value = document.getElementById("url_contains"+j).value;
document.getElementById("header_name"+i).value = document.getElementById("header_name"+j).value;
document.getElementById("header_value"+i).value = document.getElementById("header_value"+j).value;
document.getElementById("comment"+i).value = document.getElementById("comment"+j).value;
setButtonStatus(document.getElementById("activate_button"+i),getButtonStatus(document.getElementById("activate_button"+j)));
document.getElementById("apply_on"+i).value = document.getElementById("apply_on"+j).value;
}
}
let Node_to_delete = document.getElementById("line"+(line_number-1));
Node_to_delete.parentNode.removeChild(Node_to_delete);
line_number--;
}
/**
* Invert two configuration lines on the UI
**/
function invertLine(line1, line2) {
// if a line does not exist , do nothing
if ((line1===0)||(line2===0)||(line1>=line_number)||(line2>=line_number)) return;
// Save data for line 1
const select_action1= document.getElementById("select_action"+line1).value;
const url_contains1 = document.getElementById("url_contains"+line1).value;
const header_name1 = document.getElementById("header_name"+line1).value;
const header_value1= document.getElementById("header_value"+line1).value;
const comment1 = document.getElementById("comment"+line1).value;
const select_status1 = getButtonStatus(document.getElementById("activate_button"+line1));
const apply_on1 = document.getElementById("apply_on"+line1).value;
// Copy line 2 to line 1
document.getElementById("select_action"+line1).value = document.getElementById("select_action"+line2).value;
document.getElementById("url_contains"+line1).value = document.getElementById("url_contains"+line2).value;
document.getElementById("header_name"+line1).value = document.getElementById("header_name"+line2).value;
document.getElementById("header_value"+line1).value = document.getElementById("header_value"+line2).value;
document.getElementById("comment"+line1).value = document.getElementById("comment"+line2).value;
setButtonStatus(document.getElementById("activate_button"+line1),getButtonStatus(document.getElementById("activate_button"+line2)));
document.getElementById("apply_on"+line1).value = document.getElementById("apply_on"+line2).value;
// Copy line 1 to line 2
document.getElementById("select_action"+line2).value = select_action1;
document.getElementById("url_contains"+line2).value = url_contains1;
document.getElementById("header_name"+line2).value = header_name1;
document.getElementById("header_value"+line2).value = header_value1;
document.getElementById("comment"+line2).value = comment1;
setButtonStatus(document.getElementById("activate_button"+line2),select_status1);
document.getElementById("apply_on"+line2).value = apply_on1;
}
/**
* Stop or Start modify header
**/
function startModify() {
if (started==="off") {
saveData();
storeInBrowserStorage({started:'on'},function() {
chrome.runtime.sendMessage("on");
started = "on";
document.getElementById("start_img").src = "img/stop.png";
});
}
else {
storeInBrowserStorage({started:'off'},function() {
chrome.runtime.sendMessage("off");
started = "off";
document.getElementById("start_img").src = "img/start.png";
});
}
}
.input_field_small{
width: 120px;
}
.input_field_medium{
width: 170px;
}
.input_field_large{
width: 250px;
}
.input_url {
width:500px;
}
.standard_table {
width:930px;
}
.input_field_small{
width: 80px;
}
.input_field_medium{
width: 110px;
}
.input_field_large{
width: 170px;
}
.input_url {
width:200px;
}
.standard_table {
width:750px;
}
downloader/popup/img/help.png

1.15 KiB

downloader/popup/img/start.png

3.35 KiB

downloader/popup/img/stop.png

3.99 KiB

downloader/popup/img/stop_big.png

17.3 KiB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Menu </title>
<style type="text/css">
.button {
background-color: #008CBA; /* Blue */
border: none;
color: white;
padding: 1px 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
border-radius: 4px;
transition-duration: 0.4s;
width="100px";
}
.button:hover {
background-color: #0070A0;
}
</style>
</head>
<body>
<table>
<tr>
<td> <input type="button" class="button" style="width:100px" id="config" value="Configure"></input> </td>
<td> <input type="button" class="button" style="width:100px" id="start_stop" value="Start" ></input> </td>
</tr>
</table>
</center>
<script type="text/javascript" src="menu.js"> </script>
</body>
</html>
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @author didierfred@gmail.com
*/
var started = "off";
window.onload = function() {
document.getElementById('config').addEventListener('click',function (e) {start_config();});
document.getElementById('start_stop').addEventListener('click',function (e) {start_modify();});
loadFromBrowserStorage(['started'],function(result) {
started =result.started;
if (started==="on") document.getElementById("start_stop").value = "Stop";
});
}
function loadFromBrowserStorage(item,callback_function) {
chrome.storage.local.get(item, callback_function);
}
function storeInBrowserStorage(item,callback_function) {
chrome.storage.local.set(item,callback_function);
}
function start_modify() {
if (started==="off") {
storeInBrowserStorage({started:'on'},function() {
chrome.runtime.sendMessage("on");
started = "on";
document.getElementById("start_stop").value = "Stop";
// if exists reload config tab , to get the start/stop information correct
chrome.tabs.query({currentWindow: true},reloadConfigTab);
});
}
else {
storeInBrowserStorage({started:'off'},function() {
chrome.runtime.sendMessage("off");
started = "off";
document.getElementById("start_stop").value = "Start";
// if exists reload config tab , to get the start/stop information correct
chrome.tabs.query({currentWindow: true},reloadConfigTab);
});
}
}
function reloadConfigTab(tabs) {
var config_tab;
// search for config tab
for (let tab of tabs) {
if (tab.url.startsWith(chrome.extension.getURL(""))) config_tab = tab;
}
// config tab exists , reload it
if (config_tab) chrome.tabs.reload(config_tab.id);
}
function start_config() {
chrome.tabs.query({currentWindow: true},loadConfigTab);
}
function loadConfigTab(tabs) {
var config_tab;
// search for config tab
for (let tab of tabs) {
if (tab.url.startsWith(chrome.extension.getURL(""))) config_tab = tab;
}
// config tab exits , put the focus on it
if (config_tab) chrome.tabs.update(config_tab.id,{active:true})
// else create a new tab
else chrome.tabs.create({url:"/popup/config.html"});
}
downloader/screenshot.png

56.3 KiB

Copyright (c) 2008-2017 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v3.3.0</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-3.3.0/jasmine_favicon.png">
<link rel="stylesheet" href="lib/jasmine-3.3.0/jasmine.css">
<script src="../popup/config.js"></script>
<script src="lib/jasmine-3.3.0/jasmine.js"></script>
<script src="lib/jasmine-3.3.0/jasmine-html.js"></script>
<script src="lib/jasmine-3.3.0/boot.js"></script>
<!-- include source files here... -->
<!-- include spec files here... -->
<script src="spec/ConfigSpec.js"></script>
</head>
<body>
<div hidden>
<!-- MAIN SCREEN -->
<div id="main_screen" style="text-align:center">
<table class="standard_table">
<tr>
<td style="text-align:left"><h2 class="title"> SIMPLE MODIFY HEADERS </h2> </td>
<td style="text-align:right"> <img id="start_img" src="img/start.png" alt="start/stop" style="float:right;vertical-align:top"> </img> </td>
</tr>
</table>
<br/>
<br/>
<table class="standard_table">
<tr>
<td style="text-align:left" > <strong> Url Patterns* : </strong> <input id="targetPage" class="form_control input_url" type="text" value=""> </td>
<td style="text-align:right">
<a href="#" id="export_button" class="btn btn-primary btn-sm" >
<span class="glyphicon glyphicon-export"></span> Export
</a>
<a href="#" id="import_button" class="btn btn-primary btn-sm" >
<span class="glyphicon glyphicon-import"></span> Import
</a>
<a href="#" id="parameters_button" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-cog"></span> Parameters
</a>
</td>
</tr>
</table>
<br/> <br/>
<table id="table_config" class="table table-condensed " >
<thead>
<tr id="config_table_head">
<th> When URL contains </th>
<th> Action </th>
<th> Header Field Name </th>
<th> Header Field Value </th>
<th> Comment </th>
<th> Apply on </th>
<th> Status </th>
<th> </th>
<th> </th>
<th> </th>
</tr>
</thead>
<tbody id="config_tab">
</tbody>
</table>
<table class="standard_table"> <tr><td style="text-align:center">
<a href="#" id="add_button" class="btn btn-primary btn-sm" style="width:100px">
<span class="glyphicon glyphicon-plus"></span> New line
</a>
<a href="#" id="save_button" class="btn btn-primary btn-sm" style="width:100px">
<span class="glyphicon glyphicon-save"></span> Save
</a>
</td></tr></table>
<br/>
<table class="standard_table">
<tr>
<td style="text-align:left" >
<em style="font-size:10pt"> * Information on URL patterns can be found <a href="https://developer.chrome.com/extensions/match_patterns" target="_blank"> here.</a> <br> An empty string on the field will select all URLs. It's possible to select multiple URL patterns using semicolon (;) separator </em>
</td>
<td style="text-align:right">
<a href="https://github.com/didierfred/SimpleModifyHeaders/tree/v1.6.2" target="_blank"> <span class="glyphicon glyphicon-question-sign"></span> About </a>
</td>
</tr>
</table>
</div>
<!-- PARAMETERS SCREEN -->
<div id="parameters_screen" hidden>
<h2 class="title"> SIMPLE MODIFY HEADERS </h2>
<strong> Parameters : </strong>
<br/>
<br/>
<input type="checkbox" id="debug_mode"> Debug mode </input>
<br/>
<input type="checkbox" id="show_comments"> Show comments </input>
<br/>
<input type="checkbox" id="use_url_contains"> Filter URL per rules </input>
<br/>
<br/>
<a href="#" id="exit_parameters_screen_button" class="btn btn-primary btn-sm" style="width:100px">
<span class="glyphicon glyphicon-step-backward"></span> Back
</a>
</div>
<iframe id="download" title="hidden_download_frame" width="0" height="0" style="border:none;">
</iframe>
<br/>
</div>
</div>
</body>
</html>
/**
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
*/
(function() {
/**
* ## Require &amp; Instantiate
*
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
*/
window.jasmine = jasmineRequire.core(jasmineRequire);
/**
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
*/
jasmineRequire.html(jasmine);
/**
* Create the Jasmine environment. This is used to run all specs in a project.
*/
var env = jasmine.getEnv();
/**
* ## The Global Interface
*
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
*/
var jasmineInterface = jasmineRequire.interface(jasmine, env);
/**
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
*/
extend(window, jasmineInterface);
/**
* ## Runner Parameters
*
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
*/
var queryString = new jasmine.QueryString({
getWindowLocation: function() { return window.location; }
});
var filterSpecs = !!queryString.getParam("spec");
var config = {
failFast: queryString.getParam("failFast"),
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
hideDisabled: queryString.getParam("hideDisabled")
};
var random = queryString.getParam("random");
if (random !== undefined && random !== "") {
config.random = random;
}
var seed = queryString.getParam("seed");
if (seed) {
config.seed = seed;
}
/**
* ## Reporters
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
*/
var htmlReporter = new jasmine.HtmlReporter({
env: env,
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
getContainer: function() { return document.body; },
createElement: function() { return document.createElement.apply(document, arguments); },
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
timer: new jasmine.Timer(),
filterSpecs: filterSpecs
});
/**
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
*/
env.addReporter(jasmineInterface.jsApiReporter);
env.addReporter(htmlReporter);
/**
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
*/
var specFilter = new jasmine.HtmlSpecFilter({
filterString: function() { return queryString.getParam("spec"); }
});
config.specFilter = function(spec) {
return specFilter.matches(spec.getFullName());
};
env.configure(config);
/**
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
*/
window.setTimeout = window.setTimeout;
window.setInterval = window.setInterval;
window.clearTimeout = window.clearTimeout;
window.clearInterval = window.clearInterval;
/**
* ## Execution
*
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
*/
var currentWindowOnload = window.onload;
window.onload = function() {
// if (currentWindowOnload) {
// currentWindowOnload();
// }
htmlReporter.initialize();
env.execute();
};
/**
* Helper function for readability above.
*/
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
}());
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
downloader/tests/lib/jasmine-3.3.0/jasmine_favicon.png

1.45 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment