Commit 4cb31642 authored by CardBook's avatar CardBook

version 30.1

parent d50521ae
......@@ -165,7 +165,8 @@ if ("undefined" == typeof(cardbookCardParser)) {
var re = /[\n\u0085\u2028\u2029]|\r\n?/;
var vCardDataArray = cardbookUtils.cleanArrayWithoutTrim(vCardData.split(re));
if (vCardDataArray.indexOf("VERSION:3.0") >= 0 || vCardDataArray.indexOf("VERSION:4.0") >= 0) {
if (vCardDataArray.indexOf("VERSION:3.0") >= 0 || vCardDataArray.indexOf("VERSION:4.0") >= 0
|| vCardDataArray.indexOf("version:3.0") >= 0 || vCardDataArray.indexOf("version:4.0") >= 0) {
try {
// For multilines data
var limit = vCardDataArray.length-1;
......
......@@ -2296,7 +2296,7 @@ if ("undefined" == typeof(cardbookSynchronization)) {
var fileContentArrayLength = fileContentArray.length
if (aParams.aImportMode.endsWith("FILE")) {
for (let i = 0; i < fileContentArrayLength; i++) {
if (fileContentArray[i] == "BEGIN:VCARD") {
if (fileContentArray[i].toUpperCase() == "BEGIN:VCARD") {
cardbookRepository.cardbookServerSyncTotal[aParams.aPrefId]++;
}
}
......@@ -2305,9 +2305,9 @@ if ("undefined" == typeof(cardbookSynchronization)) {
cardbookRepository.importConflictChoice = "write";
var cardContent = "";
for (let i = 0; i < fileContentArrayLength; i++) {
if (fileContentArray[i].startsWith("BEGIN:VCARD")) {
if (fileContentArray[i].toUpperCase().startsWith("BEGIN:VCARD")) {
cardContent = fileContentArray[i];
} else if (fileContentArray[i].startsWith("END:VCARD")) {
} else if (fileContentArray[i].toUpperCase().startsWith("END:VCARD")) {
cardContent = cardContent + "\r\n" + fileContentArray[i];
try {
var myCard = new cardbookCardParser(cardContent, "", "", aParams.aPrefId);
......
......@@ -248,8 +248,8 @@ if ("undefined" == typeof(cardbookTypes)) {
var j = 0;
while (true) {
if (document.getElementById(typesList[i] + '_' + j + '_prefWeightBox')) {
var field = document.getElementById(typesList[i] + '_' + j + '_prefWeightBoxLabel').getAttribute('value').toLowerCase();
var data = document.getElementById(typesList[i] + '_' + j + '_prefWeightBox').getAttribute('value');
var field = document.getElementById(typesList[i] + '_' + j + '_prefWeightBoxLabel').value.toLowerCase();
var data = document.getElementById(typesList[i] + '_' + j + '_prefWeightBox').value;
var dummy = data.replace(/[0-9]*/g, "");
if (data == "") {
j++;
......@@ -280,7 +280,7 @@ if ("undefined" == typeof(cardbookTypes)) {
while (true) {
if (document.getElementById('mailPopularity_' + i + '_row')) {
var field = document.getElementById('mailPopularityTab').label.toLowerCase();
var data = document.getElementById('popularity_' + i + '_Textbox').getAttribute('value');
var data = document.getElementById('popularity_' + i + '_Textbox').value;
var dummy = data.replace(/[0-9]*/g, "");
if (data == "") {
i++;
......@@ -308,9 +308,9 @@ if ("undefined" == typeof(cardbookTypes)) {
var myLineTypeResult = [];
var myPrefButton = document.getElementById(aType + '_' + aIndex + '_PrefImage');
if (document.getElementById('versionTextBox').getAttribute('value') === "4.0") {
if (document.getElementById('versionTextBox').value === "4.0") {
if (myPrefButton.getAttribute('haspref')) {
var aPrefWeightBoxValue = document.getElementById(aType + '_' + aIndex + '_prefWeightBox').getAttribute('value');
var aPrefWeightBoxValue = document.getElementById(aType + '_' + aIndex + '_prefWeightBox').value;
if (aPrefWeightBoxValue != null && aPrefWeightBoxValue !== undefined && aPrefWeightBoxValue != "") {
myLineTypeResult.push("PREF=" + aPrefWeightBoxValue);
} else {
......@@ -323,7 +323,7 @@ if ("undefined" == typeof(cardbookTypes)) {
}
}
var myLineOtherType = document.getElementById(aType + '_' + aIndex + '_othersTypesBox').getAttribute('value');
var myLineOtherType = document.getElementById(aType + '_' + aIndex + '_othersTypesBox').value;
if (myLineOtherType != null && myLineOtherType !== undefined && myLineOtherType != "") {
myLineTypeResult = myLineTypeResult.concat(myLineOtherType.split(','));
}
......@@ -352,7 +352,7 @@ if ("undefined" == typeof(cardbookTypes)) {
var myLineTypeValue = [];
while (true) {
if (document.getElementById(aType + '_' + aIndex + '_valueBox_' + j)) {
var myTypeValue = document.getElementById(aType + '_' + aIndex + '_valueBox_' + j).getAttribute('value').replace(/\\n/g, "\n").trim();
var myTypeValue = document.getElementById(aType + '_' + aIndex + '_valueBox_' + j).value.replace(/\\n/g, "\n").trim();
myLineTypeValue.push(myTypeValue);
j++;
} else {
......@@ -360,7 +360,7 @@ if ("undefined" == typeof(cardbookTypes)) {
}
}
} else {
var myLineTypeValue = [document.getElementById(aType + '_' + aIndex + '_valueBox').getAttribute('value').trim()];
var myLineTypeValue = [document.getElementById(aType + '_' + aIndex + '_valueBox').value.trim()];
}
if (aType == "impp" && document.getElementById(aType + '_' + aIndex + '_menulistIMPP').selectedItem) {
......@@ -419,7 +419,7 @@ if ("undefined" == typeof(cardbookTypes)) {
disableButtons: function (aType, aIndex, aVersion) {
if (aIndex == 0) {
if (document.getElementById(aType + '_' + aIndex + '_valueBox').getAttribute('value') == "") {
if (document.getElementById(aType + '_' + aIndex + '_valueBox').value == "") {
document.getElementById(aType + '_' + aIndex + '_' + aVersion + '_cardbookremoveButton').disabled = true;
document.getElementById(aType + '_' + aIndex + '_' + aVersion + '_cardbookaddButton').disabled = true;
} else {
......@@ -612,7 +612,7 @@ if ("undefined" == typeof(cardbookTypes)) {
var aPrefButton = cardbookElementTools.addPrefStar(aHBox, aType, aIndex, cardbookUtils.getPrefBooleanFromTypes(aInputTypes))
cardbookElementTools.addLabel(aHBox, aType + '_' + aIndex + '_prefWeightBoxLabel', cardbookPreferences.getPrefValueLabel(), aType + '_' + aIndex + '_prefWeightBox', {tooltip: strBundle.getString("prefWeightTooltip")});
cardbookElementTools.addTextbox(aHBox, aType + '_' + aIndex + '_prefWeightBox', cardbookUtils.getPrefValueFromTypes(aInputTypes, document.getElementById('versionTextBox').getAttribute('value')), {size: "5"});
cardbookElementTools.addTextbox(aHBox, aType + '_' + aIndex + '_prefWeightBox', cardbookUtils.getPrefValueFromTypes(aInputTypes, document.getElementById('versionTextBox').value), {size: "5"});
if (aPrefButton.getAttribute('haspref')) {
document.getElementById(aType + '_' + aIndex + '_prefWeightBoxLabel').disabled = false;
document.getElementById(aType + '_' + aIndex + '_prefWeightBox').disabled = false;
......@@ -622,7 +622,7 @@ if ("undefined" == typeof(cardbookTypes)) {
}
var usePreferenceValue = cardbookPreferences.getBoolPref("extensions.cardbook.usePreferenceValue");
if (document.getElementById('versionTextBox').getAttribute('value') === "4.0" && usePreferenceValue) {
if (document.getElementById('versionTextBox').value === "4.0" && usePreferenceValue) {
document.getElementById(aType + '_' + aIndex + '_prefWeightBoxLabel').removeAttribute('hidden');
document.getElementById(aType + '_' + aIndex + '_prefWeightBox').removeAttribute('hidden');
} else {
......@@ -757,7 +757,7 @@ if ("undefined" == typeof(cardbookTypes)) {
return;
}
var myIdArray = this.id.split('_');
var myValue = document.getElementById(myIdArray[0] + '_' + myIdArray[1] + '_valueBox').getAttribute('value');
var myValue = document.getElementById(myIdArray[0] + '_' + myIdArray[1] + '_valueBox').value;
if (myValue == "") {
return;
}
......@@ -811,9 +811,9 @@ if ("undefined" == typeof(cardbookTypes)) {
if (aFollowLink) {
myContextMenu = aType + 'TreeContextMenu';
}
cardbookElementTools.addTextbox(aRow, aType + '_' + aIndex + '_prefWeightBox', cardbookUtils.getPrefValueFromTypes(aInputTypes, document.getElementById('versionTextBox').getAttribute('value')),
cardbookElementTools.addTextbox(aRow, aType + '_' + aIndex + '_prefWeightBox', cardbookUtils.getPrefValueFromTypes(aInputTypes, document.getElementById('versionTextBox').value),
{readonly: 'true'});
if (document.getElementById('versionTextBox').getAttribute('value') === "4.0") {
if (document.getElementById('versionTextBox').value === "4.0") {
document.getElementById(aType + '_' + aIndex + '_prefWeightBox').setAttribute('hidden', 'false');
document.getElementById(aType + '_' + aIndex + '_prefWeightBox').setAttribute('width', '3');
} else {
......
......@@ -901,7 +901,7 @@ if ("undefined" == typeof(cardbookUtils)) {
if (aCard.gender != "") {
document.getElementById('genderTextBox').value = cardbookRepository.cardbookGenderLookup[aCard.gender];
}
var myRemainingOthers = [];
myRemainingOthers = cardbookTypes.constructCustom(aReadOnly, 'pers', aCard.others);
......@@ -914,7 +914,7 @@ if ("undefined" == typeof(cardbookUtils)) {
} else {
document.getElementById('othersTextBox').removeAttribute('readonly');
}
var fieldArray = [ [ "photo", "localURI" ] , [ "photo", "URI" ], [ "logo", "localURI" ] , [ "logo", "URI" ], [ "sound", "localURI" ] , [ "sound", "URI" ] ];
for (var i = 0; i < fieldArray.length; i++) {
if (document.getElementById(fieldArray[i][0] + fieldArray[i][1] + 'TextBox')) {
......@@ -929,28 +929,29 @@ if ("undefined" == typeof(cardbookUtils)) {
wdw_imageEdition.displayImageCard(aCard, !aReadOnly);
wdw_cardEdition.display40(aCard.version, aReadOnly);
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
if (aReadOnly) {
if (aCard[typesList[i]].length > 0) {
cardbookTypes.constructStaticRows(aCard.dirPrefId, typesList[i], aCard[typesList[i]], aCard.version, aFollowLink);
} else {
cardbookElementTools.deleteRowsAllTypes(typesList[i]);
}
} else {
if (typesList[i] === "impp") {
cardbookTypes.loadIMPPs(aCard[typesList[i]]);
}
cardbookTypes.constructDynamicRows(typesList[i], aCard[typesList[i]], aCard.version);
}
}
if (aCard.isAList) {
if (aReadOnly) {
cardbookTypes.loadStaticList(aCard, aFollowLink);
} else {
wdw_cardEdition.displayLists(aCard);
}
} else {
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
if (aReadOnly) {
if (aCard[typesList[i]].length > 0) {
cardbookTypes.constructStaticRows(aCard.dirPrefId, typesList[i], aCard[typesList[i]], aCard.version, aFollowLink);
} else {
cardbookElementTools.deleteRowsAllTypes(typesList[i]);
}
} else {
if (typesList[i] === "impp") {
cardbookTypes.loadIMPPs(aCard[typesList[i]]);
}
cardbookTypes.constructDynamicRows(typesList[i], aCard[typesList[i]], aCard.version);
}
}
}
cardbookTypes.loadMailPopularity(aCard, aReadOnly);
},
......
......@@ -95,7 +95,7 @@ if ("undefined" == typeof(ovl_synchro)) {
prefs.setCharPref("accountsShown", "all");
prefs.setCharPref("accountShown", "");
prefs.setCharPref("uncategorizedCards", "");
prefs.setCharPref("addonVersion", "30.0");
prefs.setCharPref("addonVersion", "30.1");
},
lEventTimerSync : { notify: function(lTimerSync) {
......
......@@ -1862,6 +1862,7 @@ if ("undefined" == typeof(wdw_cardbook)) {
break;
}
}
wdw_cardbook.clearCard();
wdw_cardbook.clearAccountOrCat();
wdw_cardbook.setNoSearchMode();
wdw_cardbook.loadCssRules();
......
......@@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>cardbook@vigneau.philippe</em:id>
<em:name>CardBook</em:name>
<em:version>30.0</em:version>
<em:version>30.1</em:version>
<em:type>2</em:type>
<em:description>vCard Address Book</em:description>
<em:creator>Philippe Vigneau</em:creator>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment