0 Replies Latest reply: Dec 15, 2014 4:10 AM by espen skeie RSS

    Extension - how to add a logo to the background via js-script

    espen skeie

      Hi

       

      I'm trying to add a logo that should appear in the upper right corner. So far I've only been able to add it ABOVE the tabrow, but I would like it to be under tabrow, but not in conflict with the other objects on the page.

       

      Here's what I have in script.js:

       

      var path = Qva.Remote + "?public=only&type=Document&name=Extensions/defaultLayout/";

      Qva.LoadCSS(path + "style.css");

      Qva.LoadScript(path + 'cufon-yui.js', function(){

          Qva.LoadScript(path + 'harabara.cufonfonts.js', function(){

              Qva.AddDocumentExtension('defaultLayout', function(){

                  var _this = this;

                  function centerIt() {

                      if (!($("body").hasClass("centerAlign"))) {

                          $("body").addClass("centerAlign");

                          //wrap a container around the whole document and center it.

                          $("body").append('<div class="master" />').find('.master').append($('#PageContainer'));

                          $("#MainContainer").css("position", "relative");

                          $("<h1/>", { id: "logo", text: "Evry" }).css("background", "url('" + path + "my_logo_small.png')no-repeat transparent top right").prependTo($("body"));

                          //center the tabs if they exist

                          $("head").append("<style>.qvtr-tabs-wrap{margin:0 auto !important;}</style>");

                          $("body").css("background-image")

                          //center the background image if there is one.

                          $("body").css("background-position", "center 100%");

                          //$("h1").css("background-position", "right 20px");

                      }

                      var maxRight = 1024;

                      //loop through all QV alements on the page and determine the maximum right position on the page

                      //in order to determine the bounding box of the QV doc.  It needs to be done this way because all of the elements

                      //are absolutely positioned

                      $(".QvFrame").each(function () {

                          var tMR = $(this).position().left + $(this).width();

                          if (tMR > maxRight) {

                              maxRight = tMR;

                          }

                      });

                      $(".centerAlign .master").css("width", maxRight + "px");

                      $(".qvtr-tabs-wrap").css("width", $(".master").width() + "px");

                  }

                  _this.Document.SetOnUpdateComplete(centerIt);

              });

          });

      });