Index.vue 4.3 KB

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