--- /dev/null
+/*\r
+ Copyright 2010 Google Inc.\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+*/\r
+\r
+/** @fileoverview Example of how to use the bookmark bubble. */\r
+\r
+window.addEventListener('load', function() {\r
+ window.setTimeout(function() {\r
+ var bubble = new google.bookmarkbubble.Bubble();\r
+\r
+\r
+ bubble.hasHashParameter = function() {\r
+ return $.cookie('bubble');\r
+ };\r
+\r
+ bubble.setHashParameter = function() {\r
+ if (!this.hasHashParameter()) {\r
+ $.cookie('bubble', true, { expires: 365 });\r
+ }\r
+ };\r
+\r
+ bubble.getViewportHeight = function() {\r
+ window.console.log('Example of how to override getViewportHeight.');\r
+ return window.innerHeight;\r
+ };\r
+\r
+ bubble.getViewportScrollY = function() {\r
+ window.console.log('Example of how to override getViewportScrollY.');\r
+ return window.pageYOffset;\r
+ };\r
+\r
+ bubble.registerScrollHandler = function(handler) {\r
+ window.console.log('Example of how to override registerScrollHandler.');\r
+ window.addEventListener('scroll', handler, false);\r
+ };\r
+\r
+ bubble.deregisterScrollHandler = function(handler) {\r
+ window.console.log('Example of how to override deregisterScrollHandler.');\r
+ window.removeEventListener('scroll', handler, false);\r
+ };\r
+\r
+ bubble.showIfAllowed();\r
+ }, 1000);\r
+}, false);\r