Sha256: ef1965d8726007290dfead7f0135024b6e55a8808dc601ac8edb255def0df3fe

Contents?: true

Size: 1.25 KB

Versions: 19

Compression:

Stored size: 1.25 KB

Contents

#= require jquery.qrcode.min

window.SocialShareWeChatButton =
  init: (opts={}) ->
    $wDialog = "<div id='ss-wechat-dialog' class='ss-wechat-dialog'>
                  <div class='wechat-popup-header'>
                    <span>#{opts.header}</span>
                    <a href='#' onclick='return false;' class='wechat-popup-close'>×</a>
                  </div>
                  <div id='ss-wechat-dialog-qr' class='wechat-dialog-qr'></div>
                  <div class='wechat-popup-footer'>
                    #{opts.footer}
                  </div>
               </div>"

    $("body").append($wDialog)

   bindEvents: ()->
     $wContainer = $("#ss-wechat-dialog")
     $wContainer.find(".wechat-popup-close").on "click", (e) ->
       $wContainer.hide()

   qrcode: (opts={}) ->
     unless $("#ss-wechat-dialog").length
       @init(opts)
       @bindEvents()

     $wBody = $('#ss-wechat-dialog-qr')
     $wBody.empty()
     $wBody.qrcode
       width: 200
       height: 200
       text: opts.url

     $wContainer = $("#ss-wechat-dialog")
     top = ($(window).height() - $wContainer.height()) / 2
     top = 100 if top < 100
     left = ($(window).width() - $wContainer.width()) / 2

     $wContainer.css
       top: top
       left: left

     $wContainer.show()

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
social-share-button-1.2.4 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-1.2.3 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-1.2.2 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-1.2.1 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-srules-0.1.1 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-srules-0.1.0 app/assets/javascripts/social-share-button/wechat.coffee
SocialShareFeature-0.1.4 app/assets/javascripts/share_button/wechat.coffee
social-share-button-1.2.0 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-1.1.0 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-1.0.0 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.10.0 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.9.0 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.8 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.7 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.6 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.5 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.4 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.2 app/assets/javascripts/social-share-button/wechat.coffee
social-share-button-0.8.1 app/assets/javascripts/social-share-button/wechat.coffee