Skip navigation.

BreezeTags Simple Sharing Solution API

Possible ways to use SSS on the page

  1. Simplest - useful when you need just one widget on the page - put following snippet of code to the place below of tag, where you want the widget to appear. Widget is configurable through the parameters passed with script.
          ...
          <body>
          ...
          <p>Very interesting thing happened yesterday..... </p>
          <script src="http://breezetags-test.s3.amazonaws.com/ssss/loader/ssss.js?pid=123&attach_type=here" type="text/javascript"></script>
          ...
          </body>
  2. Standard - you put part inside of the tag and put BREEZETAGS.create() to the place below of tag, where you want the widget to appear.
          <head>
          ...
          <script src="http://breezetags-test.s3.amazonaws.com/ssss/loader/ssss.js?pid=123" type="text/javascript"></script>
          </head>
          <body>
          ...
          <p>Very interesting thing happened yesterday..... </p>
          <script type="text/javascript"> BREEZETAGS.create({default_view:'email'});</script>
          ...
          </body>
  3. Advanced - useful if eg. you can't modify section - you can create script element via DOM calls and then function attach_share_widget() is called via callback to attach and configure sharing widget.
          ...
          <body>
          ...
                <script type="text/javascript">

                  //prepare and attach sharing widget
                  function attach_share_widget(){
                   //we create container for anchor of the sharing widget
                   var cont_element = document.createElement("span");
                   cont_element.setAttribute("id", "sharex");

                   document.getElementsByTagName("body")[0].appendChild(cont_element);
                   //or you could use following line if you use Prototype
                   //$(document.body).appendChild(Builder.node('div',{id:"sharex"},[TN("X")]));

                   BREEZETAGS.create({attach_type:'container', dest_id:'sharex', default_view:'email'});       
                  }

                  function add_breeze(url){
                     var script_element = document.createElement("script");
                     script_element.setAttribute("type", "text/javascript");
                     script_element.setAttribute("language", "JavaScript");
                     script_element.setAttribute("src", url);

                     document.getElementsByTagName("head")[0].appendChild(script_element);
                  }
                 
                  //note `callback` and `init_time` parameters
                  // In the case when script is retrieved when DOM is loaded, you need to set `init_time` to `nowait`.
                  add_breeze("http://breezetags-test.s3.amazonaws.com/ssss/loader/ssss.js?pid=1234&init_time=nowait&callback=attach_share_widget");
                </script>
          ....
          </body>

    Another example - view live example at http://www.breezetags.com/cms/?q=node/6 :

    ...
      <body>
        <h4>Content header</h4>
        <p>Text <span id="first_share"></span></p>
        <p>Text and more text <span id="second_share"></span></p>
        <p>Text and much more <span id="third_share">Click here to open widget</span></p>
        <script type="text/javascript">
          //prepare and attach sharing widget
          function attach_share_widget(){
           BREEZETAGS.create({
             attach_type:'container', dest_id:'first_share',
             default_view:'email', url:'http://www.yourdomain.com/1', title:'First link',
             link_text:'Click to share 1', tooltip:"Open share widget on email tab"
            });

            BREEZETAGS.create({
             attach_type:'container', dest_id:'second_share',
             url:'http://www.yourdomain.com/2', title:'Title of the second link'
            });

           BREEZETAGS.create({
             attach_type:'behavior', dest_id:'third_share',
             default_view:'phone', url:'http://www.yourdomain.com/3', title:'Third link'
            });
          }

          function add_breeze(url){
             var script_element = document.createElement("script");
             script_element.setAttribute("type", "text/javascript");
             script_element.setAttribute("language", "JavaScript");
             script_element.setAttribute("src", url);

             document.getElementsByTagName("head")[0].appendChild(script_element);
          }

          //note `callback` parameter
          add_breeze("http://breezetags-test.s3.amazonaws.com/ssss/loader/ssss.js?pid=123&init_time=nowait&callback=attach_share_widget");

        </script>
      </body>
    ...

    Parameters to SSSS

    • Required:
      1. pid = your_own_publisher_id.This parameter must always be passed to <script ...>.
    • Optional:
      1. init_time = 'one_of_values_below'. If this parameter is not given, then the default one is used.
        1. onload - default option - script initializes on document load event
        2. nowait - script doesn't wait for external events to proceed with initialization. Useful, script is loaded via DOM calls already when document load event passed.
      2. attach_type : 'one_of_values_below'. If this parameter is not given, then the default one is used.
        1. noauto - default option - sharing widget button is not created.
        2. container - creates anchor and attaches it to DOM element specified by dest_id. This option requires parameter dest_id. If element with id = dest_id is not given or not found, widget is not attached to the page.
        3. behavior - no anchor is created, but it registers opening of sharing widget to onclick event of element dest_id. Together with default_view it allows direct linking of custom buttons to opening of sharing widget on specific view.
        4. here - script attaches the button at the place where the script is put.
      3. callback : 'name_of_global_function'. After script will be loaded and initialized, it will call name_of_global_function. Useful to sync loading of script with the function that creates sharing widgets on the page.
      4. dest_id : 'id_of_DOM_element'. This parameter must be used only if attach_type parameter is set to container or behavior.
      5. link_text : 'Click me to share'. It is text that appears on button that opens sharing widget.
      6. tooltip : 'Clicking here will open sharing widget'. Text that is shown when cursor is hovered over the link that opens sharing widget.
      7. url : 'link_including_protocol'. Default is document.URL. Ex.: link : 'http://youdomaingoeshere.com/shared_stuff.html'
      8. title : 'string_in_utf8'. Default is document.title.
      9. default_view : 'one_of_values_below'. This parameter sets what view is shown when sharing widget is opened. If this parameter is not given, then the default one is used.
        1. phone - default option.
        2. email
        3. sn.

    Passing parameters to SSS

    There are two ways of configuring SSS. Parameters given to SSS via

    1. Parameters given to <script src="...?param_key=param_value&.."> are considered to be global for all instances on sharing widgets. Parameters are given as: param_key=param_value&param_key2=param_value2&...
    2. BREEZETAGS.create({param_key:param_value, ... }); are applied to this particular instance of SSS. Parameters are given as part of JSON object:
                   BREEZETAGS.create(
                    {param_key:param_value, param_key1:param_value2, ... }
                   );