Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add multiple item per page (create a booklet with 4 or for more item / page) #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
function calculate()
{
duplex = document.getElementById('duplex').value;
itempp = parseInt(document.getElementById('itempp').value);
if (duplex == "1") {
document.getElementById("doublesided").style.display = "block";
document.getElementById("singlesided").style.display = "none";
Expand All @@ -19,15 +20,19 @@
var duplexlist = '';
var side1list = '';
var side2list = '';

for (var i = 1; i < count / 2; i = i + 2) {
var new1 = (count - i+1).toString() + ',' + i.toString() + ',';
var new2 = (i + 1).toString() + ',' + (count - i).toString() + ',';
side1list = side1list + new1;
side2list = side2list + new2;
duplexlist = duplexlist + new1 + new2;

for (var i = 1; i < count / 2 ; i += itempp) {
for (j = 1; j < itempp ; j += 2) {
new1 = (count-i+1-j+1).toString() + ',' + (i+j-1).toString() + ',';
side1list += new1;
duplexlist += new1;
}
for (j = 1; j < itempp ; j += 2) {
new2 = (i+j).toString() + ',' + (count-i-j+1).toString() + ',';
side2list += new2;
duplexlist += new2;
}
}

// delete last comma
side1list = side1list.substr(0, side1list.length - 1);
side2list = side2list.substr(0, side2list.length - 1);
Expand Down Expand Up @@ -81,6 +86,15 @@ <h3>Preparation</h3>
<option value="1">Yes</option>
</select>
</li>
<li>
Define items per page :
<select id="itempp" onchange="calculate();">
<option value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
</select>
</li>
</ol>

<h3>Printing</h3>
Expand All @@ -101,4 +115,4 @@ <h3>Printing</h3>
<a href="https://github.com/georgjaehnig/booklet-page-calculator"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>

</body>
</html>
</html>