-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow users to customize the default NxN grid size for the jigsaw puzzle * Bug fix in calculating the size of the jigsaw frame In some corner cases, frame size was too small or too large. * Updated copyright information
- Loading branch information
Showing
10 changed files
with
245 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
********************************************************************** | ||
* JigSaw - A Firefox Webextension that creates a jigsaw puzzle from | ||
* an image link | ||
********************************************************************** | ||
Copyright (c) 2017-2020 Arun Kunchithapatham | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Contributors: | ||
Arun Kunchithapatham - Initial Contribution | ||
*********************************************************************** | ||
* | ||
*/ | ||
|
||
.jigsaw_options_section { | ||
padding: 10px; | ||
text-align: center; | ||
font-size: 1em; | ||
background-color: #F0F8FF; | ||
cursor: pointer; | ||
} | ||
|
||
.jigsaw_options_row { | ||
padding: 4px; | ||
text-align: center; | ||
font-size: 1em; | ||
background-color: #F0F8FF; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.jigsaw_options_row:hover { | ||
background-color: #B0C4DE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!-- | ||
********************************************************************** | ||
* JigSaw - A Firefox Webextension that creates a jigsaw puzzle from | ||
* an image link | ||
********************************************************************** | ||
Copyright (c) 2017-2020 Arun Kunchithapatham | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Contributors: | ||
Arun Kunchithapatham - Initial Contribution | ||
*********************************************************************** | ||
* | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="jigsaw_options.css"/> | ||
</head> | ||
|
||
<body> | ||
<div class="jigsaw_options_panel"> | ||
|
||
<h2>Select Jigsaw Size:</h2> | ||
<div class="jigsaw_options_section"> | ||
<div class="jigsaw_options_row"> | ||
<label for="jigsaw_default_size">Jigsaw Default Size:</label> | ||
<select id="jigsaw_default_size" class="icon"> | ||
<option value="5">5</option> | ||
<option value="6">6</option> | ||
<option value="7">7</option> | ||
<option value="8">8</option> | ||
<option value="9">9</option> | ||
<option value="10">10</option> | ||
</select> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<script src="jigsaw_options.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
********************************************************************** | ||
* JigSaw - A Firefox Webextension that creates a jigsaw puzzle from | ||
* an image link | ||
********************************************************************** | ||
Copyright (c) 2017-2020 Arun Kunchithapatham | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Contributors: | ||
Arun Kunchithapatham - Initial Contribution | ||
*********************************************************************** | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var browser = browser || chrome; | ||
|
||
function saveOptions(e) { | ||
e.preventDefault(); | ||
|
||
let current_settings = { | ||
jigsaw_default_size: document.getElementById("jigsaw_default_size").value | ||
}; | ||
|
||
console.log(current_settings); | ||
browser.storage.local.set(current_settings); | ||
} | ||
|
||
function restoreOptions() { | ||
|
||
let options_list = ["jigsaw_default_size"]; | ||
|
||
for (let opt=0; opt < options_list.length; opt++) { | ||
|
||
let opt_name = options_list[opt]; | ||
|
||
let onGetOption = function (result) { | ||
if (browser.runtime.lastError) { | ||
console.log(browser.runtime.lastError); | ||
} | ||
else { | ||
let keys = Object.keys(result); | ||
for (let k=0; k < keys.length; k++) { | ||
let opt_name = keys[k]; | ||
let elem_name = opt_name; | ||
if (opt_name == "jigsaw_default_size") { | ||
document.getElementById(elem_name).value = result.jigsaw_default_size; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
let getting = browser.storage.local.get(opt_name, onGetOption); | ||
} | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", restoreOptions); | ||
document.getElementById("jigsaw_default_size").addEventListener("change", saveOptions); |