Index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <Layout>
  3. <!-- Titre, sous-titre -->
  4. <div class="blank-page no-folio fill-green"></div>
  5. <div class="v-center grow no-folio">
  6. <h1 class="pre-title center" v-html="$static.metaData.titreDuProjet" />
  7. <h2 class="pre-sub-title center" v-html="$static.metaData.sousTitre" />
  8. </div>
  9. <div class="blank-page no-folio fill-motif-cross-left"></div>
  10. <!-- Auteurs, titre, sous-titre -->
  11. <div class="column no-folio">
  12. <div class="fill-motif-cross-right layer-1">
  13. </div>
  14. <div class="column layer-2">
  15. <div class="bold center" v-for="auteur in $static.metaData.auteurs">
  16. {{auteur}}
  17. </div>
  18. <div class="v-center grow">
  19. <h1 class="main-title center highlight-white" v-html="$static.metaData.titreDuProjet" />
  20. <h2 class="main-pre-title center highlight-white" v-html="$static.metaData.sousTitre" />
  21. </div>
  22. <div class="center">
  23. <img src="/logo_popsu.png" alt="" style="width:2cm;">
  24. </div>
  25. </div>
  26. </div>
  27. <!-- Page de fond -->
  28. <div class="column image-cover image-bleed" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[1].node.url + ")", }'></div>
  29. <!-- Sommaire -->
  30. <div class="column">
  31. <div class="section-title">
  32. Sommaire
  33. </div>
  34. <div class="column justify-end table-of-content">
  35. <span v-for="edge in $page.chapters.edges.slice().reverse()" :key="'content'+edge.node.id">
  36. <a :href="'#chapter'+edge.node.id">{{ edge.node.titre }}</a>
  37. </span>
  38. </div>
  39. </div>
  40. <!-- Page blanche -->
  41. <div class="blank-page no-folio"></div>
  42. <!-- Chapitres -->
  43. <div class="hyphen" v-for="(edge,index) in $page.chapters.edges.slice().reverse()" :key="'chapter'+edge.node.id">
  44. <h2 v-bind:data-rubrique="edge.node.rubrique" v-bind:id="'chapter'+edge.node.id" class="chapter-title" v-bind:class="{ canbreak: isNotFirst(index) }" >{{ edge.node.titre }}</h2>
  45. <VueMarkdown lang="fr" class="chapter-content justify">{{edge.node.contenu}}</VueMarkdown>
  46. </div>
  47. <!-- Notes de fin de document -->
  48. <h3 class="section-title canbreak">NOTES</h3>
  49. <ol v-for="note in footnote">
  50. <li>{{note}}</li>
  51. </ol>
  52. <!-- Pleine pages avant les sections -->
  53. <div class="column image-cover cover-left green image-bleed" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  54. </div>
  55. <div class="column image-cover cover-right green image-bleed" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  56. </div>
  57. <!-- Page blanche -->
  58. <div class="blank-page no-folio"></div>
  59. <!-- Sections -->
  60. <div class="hyphen" v-for="(edge,index) in $page.sections.edges.slice().reverse()" :key="'section'+edge.node.id">
  61. <h3 class="section-title" v-bind:class="{ canbreak: isNotFirst(index) }">{{ edge.node.titre }}</h3>
  62. <VueMarkdown lang="fr" class="section-content justify">{{ edge.node.contenu }}</VueMarkdown>
  63. </div>
  64. <!-- Credits -->
  65. <div class="credits" v-for="(edge,index) in $page.credits.edges.slice().reverse()" :key="'credits'+edge.node.id">
  66. <h4>{{ edge.node.role }}</h4>
  67. <p>{{ edge.node.nom }}</p>
  68. </div>
  69. <div class="blank-page no-folio fill-green"></div>
  70. </Layout>
  71. </template>
  72. <page-query>
  73. {
  74. chapters : allchapitres{
  75. edges{node{id,titre,contenu,rubrique}}
  76. }
  77. sections : allsections{
  78. edges{node{id,titre,contenu}}
  79. }
  80. fonds : allfonds{
  81. edges{node{id,url}}
  82. }
  83. credits : allcredits{
  84. edges{node{id,nom,role}}
  85. }
  86. }
  87. </page-query>
  88. <static-query>
  89. query {
  90. metaData {
  91. titreDuProjet
  92. sousTitre
  93. auteurs
  94. }
  95. }
  96. </static-query>
  97. <script>
  98. import VueMarkdown from 'vue-markdown'
  99. import {
  100. Previewer
  101. } from 'pagedjs';
  102. export default {
  103. data:function(){
  104. return{
  105. footnote:[],
  106. }
  107. },
  108. components: {
  109. VueMarkdown
  110. },
  111. metaInfo: {
  112. title: 'HTML2print',
  113. },
  114. methods:{
  115. isNotFirst: function(index){
  116. if(index != 0) return true;
  117. return false;
  118. }
  119. },
  120. mounted() {
  121. Array.from(document.querySelectorAll("span[data-note]")).forEach(note=>{
  122. this.footnote.push(note.getAttribute("data-note"));
  123. });
  124. this.$nextTick(function () {
  125. let hyphenopoly = document.createElement('script'),
  126. hyph = document.createElement('script');
  127. hyphenopoly.setAttribute('src', 'lib/Hyphenopoly-master/Hyphenopoly_Loader.js')
  128. hyph.setAttribute('src', 'lib/hyph.js')
  129. document.head.appendChild(hyph)
  130. document.head.appendChild(hyphenopoly)
  131. hyph.onload = ()=>{
  132. Hyphenopoly.handleEvent = {
  133. hyphenopolyEnd:(e)=>{
  134. let previewer = new Previewer();
  135. previewer.preview();
  136. document.documentElement.style.cssText = 'visibility:visible !important';
  137. }
  138. }
  139. }
  140. })
  141. }
  142. }
  143. </script>