bookmark_config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Copyright 2010 Google Inc
  3. Copyright 2011 Takashi Okamoto
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. /** @fileoverview Example of how to use the bookmark bubble. */
  15. /** Don't show the bubble if click dismiss button at 3 times. */
  16. google.bookmarkbubble.Bubble.prototype.NUMBER_OF_TIMES_TO_DISMISS=3;
  17. /** page to bookmark bubble (generally, this should be top page) */
  18. /** page to bookmark bubble (generally, this should be top page) */
  19. /* if(typeof(page_popup_bubble)=="undefined"){
  20. page_popup_bubble = "#index";
  21. } */
  22. var bubble;
  23. window.addEventListener('load', bubbleloaded, false);
  24. function bubbleloaded() {
  25. window.setTimeout(function() {
  26. bubble = new google.bookmarkbubble.Bubble();
  27. bubble.getViewportHeight = function() {
  28. return window.innerHeight;
  29. };
  30. bubble.getViewportScrollY = function() {
  31. return window.pageYOffset;
  32. };
  33. bubble.registerScrollHandler = function(handler) {
  34. window.addEventListener('scroll', handler, false);
  35. };
  36. bubble.deregisterScrollHandler = function(handler) {
  37. window.removeEventListener('scroll', handler, false);
  38. };
  39. if(bubble.isMobileSafari_() && !bubble.hasHashParameter()) {
  40. document.title = document.getElementsByName('apple-mobile-web-app-title')[0].content;
  41. }
  42. bubble.showIfAllowed();
  43. }, 1000 /** delay to show the bubble */ );
  44. }