Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
dommmel committed Apr 30, 2024
0 parents commit 0534beb
Show file tree
Hide file tree
Showing 11 changed files with 2,023 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Format vCards for Nokia 2660 (30+ series)

## Why?

Nokia 2660 (30+ series) vCard import just sucks so bad.

- It only accepts a single (last) name per contact
- It cannot deal with more than two phone numbers per contact (and then, one has to be *cell* and one *home*)
- It will fail to import on many occasions.

## What?

- Break contacts into multiple vCards, e.g "John Doe" and "John Doe (1)"
- When possible use custom labels as name suffixes, e.g "John Doe (old cell)"
- Use DOS line breaks (CRLF) instead of Unix (LF)
- Have a look at the source code for more details

## How?

1. Export vcf file from iCloud or Google
2. Use the [website](http://dommmel.github.io/vcard_nokia) to upload the vcf file and download the re-formatted vcf file
3. Transfer the file to your Nokia 2660 (e.g. via Bluetooth or USB cable)
47 changes: 47 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {Parse} from './parser.js';
import {Nokia,ToVcards} from './serializer.js';

document.getElementById('fileInput').addEventListener('change', function(event) {
processFile();
});

function processFile() {
const fileInput = document.getElementById('fileInput');
if (fileInput.files.length > 0) {
const file = fileInput.files[0];
const reader = new FileReader();

reader.onload = function(e) {
let msg = "File processed."
const vCardData = e.target.result;
try {
const parsedCards = Parse(vCardData);
const nokiaJson = parsedCards.map(Nokia);
const newVCardString = nokiaJson.map(ToVcards).join('');
downloadVCard(newVCardString);
} catch (error) {
msg = "There was an error processing the file.";
}
document.getElementById('status').textContent = msg;
};
reader.onerror = function() {
document.getElementById('status').textContent = 'Failed to read the file.';
};
reader.readAsText(file);
} else {
document.getElementById('status').textContent = 'Please select a file to process.';
}
}

function downloadVCard(vCardString) {
const blob = new Blob([vCardString], { type: 'text/vcard' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'processed_vcards.vcf';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}

60 changes: 60 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Format icloud/google vCards for Nokia 2660 (30+ series)</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Format vCards for Nokia 2660 (30+ series)</h1>
<h2>Why?</h2>
<div>
Nokia 2660 (30+ series) vCard import just sucks so bad.
<ul>
<li>It only accepts a single (last) name per contact</li>
<li>
It cannot deal with more than two phone numbers per contact (and then, one has to be <em>cell</em> and one <em>home</em>)
</li>
<li>
It will fail to import on many occasions.
</li>
</ul>
</div>
<h2>What?</h2>
<ul>
<li>
Break contacts into multiple vCards, e.g " John Doe" and "John Doe (1)"
</li>
<li>
When possible use custom labels as name suffixes, e.g "John Doe (old cell)"
</li>
<li>
Use DOS line breaks (CRLF) instead of Unix (LF)
</li>
<li>
Have a look at the <a href="https://github.com/dommmel/vcard_nokia">source code</a> for more details
</li>
</ul>
<h2>How?</h2>
<ol>
<li>
Export vcf file from icould ot google
</li>
<li>
Upload here and download the re-formatted vcf file
</li>
<li>
Tranfer the file to your Nokia 2660 (e.g. via bluetooth or usb cable)
</li>
</ol>
<h2>Let's do this!</h2>
<div class="widget">
<input type="file" id="fileInput" accept=".vcf">
<p id="status"></p>
</div>
</div>
<script type="module" src="app.js"></script>
</body>
</html>
Loading

0 comments on commit 0534beb

Please sign in to comment.