Index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <Layout>
  3. <div class="blank-page no-folio"></div>
  4. <div class="v-center grow no-folio">
  5. <h1 class="pre-title center" v-html="$static.metaData.titreDuProjet" />
  6. <h2 class="pre-sub-title center" v-html="$static.metaData.sousTitre" />
  7. </div>
  8. <div class="blank-page no-folio"></div>
  9. <div class="column no-folio">
  10. <div class="bold center" v-for="auteur in $static.metaData.auteurs">
  11. {{auteur}}
  12. </div>
  13. <div class="v-center grow">
  14. <h1 class="main-title center" v-html="$static.metaData.titreDuProjet" />
  15. <h2 class="main-pre-title center" v-html="$static.metaData.sousTitre" />
  16. </div>
  17. <div class="center">
  18. Logo popsu
  19. </div>
  20. </div>
  21. <div class="column image-cover" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[1].node.url + ")", }'>
  22. <!-- Page fond 1 -->
  23. </div>
  24. <!-- Sommaire -->
  25. <div class="column column">
  26. <div class="column justify-end table-of-content">
  27. <span v-for="edge in $page.chapters.edges.slice().reverse()" :key="'content'+edge.node.id">
  28. <a :href="'#chapter'+edge.node.id">{{ edge.node.titre }}</a>
  29. </span>
  30. </div>
  31. </div>
  32. <div class="blank-page no-folio">
  33. <!-- Page blanche -->
  34. </div>
  35. <div class="hyphen" v-for="(edge,index) in $page.chapters.edges.slice().reverse()" :key="'chapter'+edge.node.id">
  36. <h2 v-bind:id="'chapter'+edge.node.id" class="chapter-title" v-bind:class="{ canbreak: isNotFirst(index) }" >{{ edge.node.titre }}</h2>
  37. <VueMarkdown lang="fr" class="chapter-content justify">{{edge.node.contenu}}</VueMarkdown>
  38. </div>
  39. <ol v-for="note in footnote">
  40. <li>{{note}}</li>
  41. </ol>
  42. <!-- Pleine pages avant les sections -->
  43. <div class="column image-cover cover-left green" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  44. <!-- Page fond 2 -->
  45. </div>
  46. <div class="column image-cover cover-right green" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  47. <!-- Page fond 2 -->
  48. </div>
  49. <div class="blank-page no-folio">
  50. <!-- Page blanche -->
  51. </div>
  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. // HELP !
  115. // https://github.com/mnater/Hyphenopoly/blob/master/docs/Events.md#teardown-event
  116. // L'event fonctionne, mais ça rend une page vierge ᕦ(ò_óˇ)ᕤ
  117. setTimeout(()=>{
  118. let previewer = new Previewer();
  119. previewer.preview()
  120. },1000)
  121. })
  122. }
  123. }
  124. </script>