Index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 image-bleed-left" 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. <h3 class="section-title">NOTES</h3>
  42. <ol v-for="note in footnote">
  43. <li>{{note}}</li>
  44. </ol>
  45. <!-- Pleine pages avant les sections -->
  46. <div class="blank-page no-folio"></div>
  47. <div class="column image-cover cover-left green image-bleed-left" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  48. </div>
  49. <div class="column image-cover cover-right green image-bleed-right" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  50. </div>
  51. <!-- Page blanche -->
  52. <div class="blank-page no-folio"></div>
  53. <!-- Sections -->
  54. <div class="hyphen" v-for="(edge,index) in $page.sections.edges.slice().reverse()" :key="'section'+edge.node.id">
  55. <h3 class="section-title" v-bind:class="{ canbreak: isNotFirst(index) }">{{ edge.node.titre }}</h3>
  56. <VueMarkdown lang="fr" class="section-content justify">{{ edge.node.contenu }}</VueMarkdown>
  57. </div>
  58. </Layout>
  59. </template>
  60. <page-query>
  61. {
  62. chapters : allchapitres{
  63. edges{node{id,titre,contenu}}
  64. }
  65. sections : allsections{
  66. edges{node{id,titre,contenu}}
  67. }
  68. fonds : allfonds{
  69. edges{node{id,url}}
  70. }
  71. }
  72. </page-query>
  73. <static-query>
  74. query {
  75. metaData {
  76. titreDuProjet
  77. sousTitre
  78. auteurs
  79. }
  80. }
  81. </static-query>
  82. <script>
  83. import VueMarkdown from 'vue-markdown'
  84. import {
  85. Previewer
  86. } from 'pagedjs';
  87. export default {
  88. data:function(){
  89. return{
  90. footnote:[],
  91. }
  92. },
  93. components: {
  94. VueMarkdown
  95. },
  96. metaInfo: {
  97. title: 'HTML2print',
  98. },
  99. methods:{
  100. isNotFirst: function(index){
  101. if(index != 0) return true;
  102. return false;
  103. }
  104. },
  105. mounted() {
  106. Array.from(document.querySelectorAll("span[data-note]")).forEach(note=>{
  107. this.footnote.push(note.getAttribute("data-note"));
  108. });
  109. this.$nextTick(function () {
  110. let hyphenopoly = document.createElement('script'),
  111. hyph = document.createElement('script');
  112. hyphenopoly.setAttribute('src', 'lib/Hyphenopoly-master/Hyphenopoly_Loader.js')
  113. hyph.setAttribute('src', 'lib/hyph.js')
  114. document.head.appendChild(hyph)
  115. document.head.appendChild(hyphenopoly)
  116. hyph.onload = ()=>{
  117. Hyphenopoly.handleEvent = {
  118. hyphenopolyEnd:(e)=>{
  119. let previewer = new Previewer();
  120. previewer.preview();
  121. document.documentElement.style.cssText = 'visibility:visible !important';
  122. }
  123. }
  124. }
  125. })
  126. }
  127. }
  128. </script>