Browse Source

fixed array parsing bug, moved frequently used functions to common.js

master
unknown 4 years ago
parent
commit
95106fab98
16 changed files with 34 additions and 170 deletions
  1. +1
    -0
      browse.html
  2. +0
    -10
      browse.js
  3. +25
    -0
      common.js
  4. +1
    -0
      dbedit/companies.html
  5. +0
    -32
      dbedit/companies.js
  6. +1
    -0
      dbedit/people.html
  7. +0
    -32
      dbedit/people.js
  8. +1
    -0
      dbedit/toys.html
  9. +1
    -0
      display/companies.html
  10. +0
    -26
      display/companies.js
  11. +1
    -0
      display/people.html
  12. +0
    -27
      display/people.js
  13. +1
    -0
      display/toys.html
  14. +0
    -26
      display/toys.js
  15. +2
    -1
      submitEntry.html
  16. +0
    -16
      submitEntry.js

+ 1
- 0
browse.html View File

@ -7,6 +7,7 @@
<link rel="stylesheet" href="navBar.css">
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="browse.js"></script>
<script src="common.js"></script>
<body>
<a href="./"> <div id="logo"><img src="img/jpp-logo2.png" alt="JPP Logo" style="margin-left:15%;" /></a></div>

+ 0
- 10
browse.js View File

@ -112,14 +112,4 @@ function setupPage(data, category)
})(row, data[i].href);
tableBody.appendChild(row);
}
}
function getParameterByName(name) {
url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

+ 25
- 0
common.js View File

@ -0,0 +1,25 @@
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push("\"" + parseTextInput(list[i].value) + "\"");
}
var string = "{" + values.toString() + "}";
return string;
}
function getParameterByName(name) {
url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

+ 1
- 0
dbedit/companies.html View File

@ -4,6 +4,7 @@
<title>View & Edit Database</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="companies.js"></script>
<script src="../common.js"></script>
</head>
<body>
<a href="./people">Edit People</a>

+ 0
- 32
dbedit/companies.js View File

@ -674,36 +674,4 @@ function setupEvents()
}
};
}
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push(parseTextInput(list[i].value));
}
var string = "{\"" + values.toString() + "\"}";
return string;
}
function parseArrayInput2(text)
{
if(text == "")
{
return null;
}
var array = text.split("|");
var string = "{" + array[0];
for(var i = 1; i < array.length; i++)
{
string += "," + array[i];
}
string += "}";
return string;
}

+ 1
- 0
dbedit/people.html View File

@ -4,6 +4,7 @@
<title>View & Edit Database</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="people.js"></script>
<script src="../common.js"></script>
</head>
<body>
<a href="./toys">Edit Toys</a>

+ 0
- 32
dbedit/people.js View File

@ -669,36 +669,4 @@ function setupEvents()
}
};
}
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push(parseTextInput(list[i].value));
}
var string = "{\"" + values.toString() + "\"}";
return string;
}
function parseArrayInput2(text)
{
if(text == "")
{
return null;
}
var array = text.split("|");
var string = "{" + array[0];
for(var i = 1; i < array.length; i++)
{
string += "," + array[i];
}
string += "}";
return string;
}

+ 1
- 0
dbedit/toys.html View File

@ -4,6 +4,7 @@
<title>View & Edit Database</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="toys.js"></script>
<script src="../common.js"></script>
</head>
<body>
<a href="./people">Edit People</a>

+ 1
- 0
display/companies.html View File

@ -5,6 +5,7 @@
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Istok+Web" rel="stylesheet">
<script src="companies.js"></script>
<script src="../common.js"></script>
<link rel="stylesheet" href="display.css">
<link rel="stylesheet" href="../navBar.css">
</head>

+ 0
- 26
display/companies.js View File

@ -266,30 +266,4 @@ function submitEdit()
// }
});
}
}
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push(parseTextInput(list[i].value));
}
var string = "{\"" + values.toString() + "\"}";
return string;
}
function getParameterByName(name) {
url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

+ 1
- 0
display/people.html View File

@ -5,6 +5,7 @@
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Istok+Web" rel="stylesheet">
<script src="people.js"></script>
<script src="../common.js"></script>
<link rel="stylesheet" href="display.css">
<link rel="stylesheet" href="../navBar.css">
</head>

+ 0
- 27
display/people.js View File

@ -275,31 +275,4 @@ function submitEdit()
// }
});
}
}
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push(parseTextInput(list[i].value));
}
var string = "{\"" + values.toString() + "\"}";
return string;
}
function getParameterByName(name)
{
url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

+ 1
- 0
display/toys.html View File

@ -5,6 +5,7 @@
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Istok+Web" rel="stylesheet">
<script src="toys.js"></script>
<script src="../common.js"></script>
<link rel="stylesheet" href="display.css">
<link rel="stylesheet" href="../navBar.css">
</head>

+ 0
- 26
display/toys.js View File

@ -297,30 +297,4 @@ function setupToyTypesDropdown(toyTypes)
}
}
}
}
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push(parseTextInput(list[i].value));
}
var string = "{\"" + values.toString() + "\"}";
return string;
}
function getParameterByName(name) {
url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

+ 2
- 1
submitEntry.html View File

@ -6,7 +6,8 @@
<link rel="stylesheet" href="submitEntry.css">
<link rel="stylesheet" href="navBar.css">
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="submitEntry.js"></script>
<script src="submitEntry.js"></script>
<script src="common.js"></script>
<body>
<a href="./index.html"> <img src="img/jpp-logo2.png" alt="JPP Logo" style="margin-left:15%;" /></a>

+ 0
- 16
submitEntry.js View File

@ -249,20 +249,4 @@ function setupToyTypesDropdown(toyTypes)
dropdown += "</select>";
document.getElementById("typesDropdown").innerHTML = dropdown;
}
function parseTextInput(text)
{
return text == "" ? null : text;
}
function parseArrayInput(list)
{
var values = [];
for (var i = 0; i < list.length; i++)
{
values.push(parseTextInput(list[i].value));
}
var string = "{\"" + values.toString() + "\"}";
return string;
}

Loading…
Cancel
Save