CarbonAds.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <script>
  2. export default {
  3. name: 'CarbonAds',
  4. watch: {
  5. '$route' (to, from) {
  6. if (
  7. to.path !== from.path
  8. // Only reload if the ad has been loaded
  9. // otherwise it's possible that the script is appended but
  10. // the ads are not loaded yet. This would result in duplicated ads.
  11. && this.$el.querySelector('#carbonads')
  12. ) {
  13. this.$el.innerHTML = ''
  14. this.load()
  15. }
  16. }
  17. },
  18. mounted () {
  19. this.load()
  20. },
  21. methods: {
  22. load () {
  23. const s = document.createElement('script')
  24. s.id = '_carbonads_js'
  25. s.src = `//cdn.carbonads.com/carbon.js?serve=CEBITKQJ&placement=jbaysolutionsgithubio`
  26. this.$el.appendChild(s)
  27. }
  28. },
  29. render (h) {
  30. return h('div', { class: 'carbon-ads' })
  31. }
  32. }
  33. </script>
  34. <style lang="stylus">
  35. .carbon-ads
  36. min-height 102px
  37. padding 1.5rem 1.5rem 0
  38. margin-bottom -0.5rem
  39. font-size 0.75rem
  40. a
  41. color #444
  42. font-weight normal
  43. display inline
  44. .carbon-img
  45. float left
  46. margin-right 1rem
  47. border 1px solid $borderColor
  48. img
  49. display block
  50. .carbon-poweredby
  51. color #999
  52. display block
  53. margin-top 0.5em
  54. @media (max-width: $MQMobile)
  55. .carbon-ads
  56. .carbon-img img
  57. width 100px
  58. height 77px
  59. </style>
  60. <!--
  61. <style lang="css">
  62. #carbonads {
  63. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
  64. Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
  65. }
  66. #carbonads {
  67. display: flex;
  68. max-width: 330px;
  69. background-color: hsl(0, 0%, 98%);
  70. box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
  71. }
  72. #carbonads a {
  73. color: inherit;
  74. text-decoration: none;
  75. }
  76. #carbonads a:hover {
  77. color: inherit;
  78. }
  79. #carbonads span {
  80. position: relative;
  81. display: block;
  82. overflow: hidden;
  83. }
  84. #carbonads .carbon-wrap {
  85. display: flex;
  86. }
  87. .carbon-img {
  88. display: block;
  89. margin: 0;
  90. line-height: 1;
  91. }
  92. .carbon-img img {
  93. display: block;
  94. }
  95. .carbon-text {
  96. font-size: 13px;
  97. padding: 10px;
  98. line-height: 1.5;
  99. text-align: left;
  100. }
  101. .carbon-poweredby {
  102. display: block;
  103. padding: 8px 10px;
  104. background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
  105. text-align: center;
  106. text-transform: uppercase;
  107. letter-spacing: .5px;
  108. font-weight: 600;
  109. font-size: 9px;
  110. line-height: 1;
  111. }
  112. </style>
  113. -->