Commit 6b1c9f13 authored by alexandre's avatar alexandre
Browse files

Séparation du javascript

parent a929dafb
$(function() {
// Choose the number of pages of the document
var nb_page = 7;
for (i = 1; i < nb_page; i++){
$("#master-page").clone().attr("id","page-"+i).insertBefore($("#master-page"));
}
$("#master-page").hide();
// Loads main content into <article id="my-story">
$("#my-story").load("content.html");
// __________________________________ MOVEABLE ELEMENTS __________________________________ //
$("div.moveable").
append("<div class='properties button'>Properties</div>").
draggable({
cursor: "move",
stack: "div.moveable",
}).
resizable();
$('.properties').on('click', function() {
var top = $(this).parent().css('top');
var left = $(this).parent().css('left');
var width = $(this).parent().width();
var height = $(this).parent().height();
var p = new Popelt({
title: "Properties to copy/paste into this object's style attribute.",
content: 'style="top: ' + top + '; left: ' + left + '; width: ' + width + 'px; height: ' + height + 'px;"',
}).show();
});
});
......@@ -5,6 +5,13 @@
@footer-height: 10mm;
@footer-text: counter(page-counter);
.header,
.body,
.footer {
box-sizing: border-box;
}
/* __________________________________ HEADER __________________________________ */
.header {
/*position: absolute;*/
......@@ -121,7 +128,6 @@ p {
}
* {
box-sizing: border-box;
-webkit-font-feature-settings: "liga", "dlig", "clig", "kern";
}
......
// Choose the number of pages of the document
var nb_page = 7;
// Loads main content into <section id="story">
$("#my-story").load("content.html");
$(window).load(function(){
$(function() {
// ________________________________ PREVIEW __________________________________ //
$("#preview").click(function(e){
e.preventDefault();
......@@ -56,13 +49,6 @@ $(window).load(function(){
});
// __________________________________ PRINT MARKS __________________________________ //
for (i = 1; i < nb_page; i++){
$("#master-page").clone().attr("id","page-"+i).insertBefore($("#master-page"));
}
$("#master-page").hide();
// __________________________________ TOC __________________________________ //
$(".paper").each(function(){
page = $(this).attr("id");
......@@ -74,25 +60,4 @@ $(window).load(function(){
$(this).toggleClass("button-active");
$("#toc-pages").toggle();
});
// __________________________________ MOVEABLE ELEMENTS __________________________________ //
$("div.moveable").
append("<div class='properties button'>Properties</div>").
draggable({
cursor: "move",
stack: "div.moveable",
}).
resizable();
$('.properties').on('click', function() {
var top = $(this).parent().css('top');
var left = $(this).parent().css('left');
var width = $(this).parent().width();
var height = $(this).parent().height();
var p = new Popelt({
title: "Properties to copy/paste into this object's style attribute.",
content: 'style="top: ' + top + '; left: ' + left + '; width: ' + width + 'px; height: ' + height + 'px;"',
}).show();
});
});
......@@ -32,8 +32,12 @@
background-color: white;
}
.paper {
width: @paper-width;
height: @paper-height;
width: @page-width;
height: @page-height;
/* Crop marks */
padding: @crop;
counter-increment: page-counter;
/* utile ou non? pour éviter qu'un papier soit coupé par le format de la
......@@ -42,12 +46,11 @@
page-break-after: always;
overflow: hidden;
/* Crop marks */
padding: @crop;
}
.page {
width: 100%;
height: 100%;
width: @page-width;
height: @page-height;
position: relative;
}
......@@ -56,9 +59,13 @@
float: left;
}
.spread .paper:first-child {
margin-left: @paper-width !important;
margin-left: @paper-width - @crop !important;
}
.spread .paper:nth-child(odd) {
padding-left: 0;
}
.spread .paper:nth-child(even) {
padding-right: 0;
}
}
......
......@@ -41,10 +41,13 @@
</div>
<!-- JAVASCRIPT -->
<script type="text/javascript" src="lib/less-1.3.0.min.js"></script>
<script type="text/javascript" src="lib/jquery.min.js"></script>
<script type="text/javascript" src="html2print.js"></script>
<script type="text/javascript" src="lib/jquery-ui-1.10.3/js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="lib/popelt-v1.0.min.js"></script>
<script type="text/javascript" src="lib/less-1.3.0.min.js"></script>
<script type="text/javascript" src="print.js"></script>
<script type="text/javascript" src="example.js"></script>
</body>
</html>
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