1/* 2 Copyright 2010 Google Inc. 3 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 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15*/ 16 17/** @fileoverview Example of how to use the bookmark bubble. */ 18 19window.addEventListener('load', function() { 20 window.setTimeout(function() { 21 var bubble = new google.bookmarkbubble.Bubble(); 22 23 var parameter = 'bmb=1'; 24 25 bubble.hasHashParameter = function() { 26 return window.location.hash.indexOf(parameter) != -1; 27 }; 28 29 bubble.setHashParameter = function() { 30 if (!this.hasHashParameter()) { 31 window.location.hash += parameter; 32 } 33 }; 34 35 bubble.getViewportHeight = function() { 36 window.console.log('Example of how to override getViewportHeight.'); 37 return window.innerHeight; 38 }; 39 40 bubble.getViewportScrollY = function() { 41 window.console.log('Example of how to override getViewportScrollY.'); 42 return window.pageYOffset; 43 }; 44 45 bubble.registerScrollHandler = function(handler) { 46 window.console.log('Example of how to override registerScrollHandler.'); 47 window.addEventListener('scroll', handler, false); 48 }; 49 50 bubble.deregisterScrollHandler = function(handler) { 51 window.console.log('Example of how to override deregisterScrollHandler.'); 52 window.removeEventListener('scroll', handler, false); 53 }; 54 55 bubble.showIfAllowed(); 56 }, 1000); 57}, false);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.