Page callback to delete a bookmark
488431
public function deleteBookmark()
    {
        $this->setBookmark();
        $this->controlAccess('bookmark_delete');

        $this->bookmark->delete(array('path' => $this->data_path));
        $this->redirect($this->data_target);
    }
404147
function(callback) {
            callback = callback || function() {};
            
            var that = this;
            var params = {
                count: this._pagesize,
                offset: this._offset
            };
            return this._endpoint(params, function(err, results) {
                if (err) {
                    callback(err);
                }
                else {                    
                    var numResults = (results.rows ? results.rows.length : 0);
                    that._offset += numResults;
                    
                    callback(null, results, numResults > 0);
                }
            });
        }
1215788
function pageHasChanged(page, oldUrl, callback) {
    var elapsed = 0;

    var newUrl;
    var urlHasChanged = false;
    var documentReady = false;
    var waitTimeOver = false;

    async.until(
        function () {
            waitTimeOver = elapsed > constants.WAIT_TIMEOUT;
            return waitTimeOver || documentReady;
        },

        function (callback) {
            // polls the page at an interval
            setTimeout(function () {
                elapsed += constants.POLL_INTERVAL;

                async.waterfall([
                    function (callback) {
                        // checks the url
                        page.get('url', function (url) {
                            newUrl = url;
                            urlHasChanged = newUrl !== oldUrl;

                            callback();
                        })
                    },
                    function (callback) {
                        if (!urlHasChanged) {
                            callback();
                            return;
                        }

                        // checks the document.readyState
                        page.evaluate(function () {
                            return (document.readyState === 'interactive') || (document.readyState === 'complete');
                        }, function (domReady) {
                            documentReady = domReady;
                            callback();
                        });
                    }
                ], function (error) {
                    // no error is triggered
                    callback();
                });
            }, constants.POLL_INTERVAL);
        },

        function (error) {
            if (waitTimeOver) {
                // todo Go back to previous url?
                callback('Timeout while navigating to ' + url);
                return;
            }

            callback();
        }
    );
}
97269
function updateDirtyRange( bookmark, dirtyRange, checkEnd ) {
		var serializable = bookmark.serializable,
			container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ],
			offset = checkEnd ? 'endOffset' : 'startOffset';

		var bookmarkStart = serializable ? dirtyRange.document.getById( bookmark.startNode ) : bookmark.startNode;

		var bookmarkEnd = serializable ? dirtyRange.document.getById( bookmark.endNode ) : bookmark.endNode;

		if ( container.equals( bookmarkStart.getPrevious() ) ) {
			dirtyRange.startOffset = dirtyRange.startOffset - container.getLength() - bookmarkEnd.getPrevious().getLength();
			container = bookmarkEnd.getNext();
		} else if ( container.equals( bookmarkEnd.getPrevious() ) ) {
			dirtyRange.startOffset = dirtyRange.startOffset - container.getLength();
			container = bookmarkEnd.getNext();
		}

		container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++;
		container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++;

		// Update and return this range.
		dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container;
		return dirtyRange;
	}
1169540
function (node, callback) {
			// important note!
			// starts paused
			//
			var bHandle = on(node.ownerDocument.documentElement, 'click', function (e) {
				var target = e.target;
				if (target.nodeType !== 1) {
					target = target.parentNode;
				}
				if (target && !node.contains(target)) {
					callback(e);
				}
			});

			var handle = {
				state: 'resumed',
				resume: function () {
					setTimeout(function () {
						bHandle.resume();
					}, 100);
					this.state = 'resumed';
				},
				pause: function () {
					bHandle.pause();
					this.state = 'paused';
				},
				remove: function () {
					bHandle.remove();
					this.state = 'removed';
				}
			};
			handle.pause();

			return handle;
		}
1109358
function (rangeLength) {
            var i, l;
            // remove out-of-range SVG from DOM
            for (i = 0, l = pages.length; i < l; ++i) {
                if (shouldUnloadPage(i, rangeLength)) {
                    this.unloadPage(i);
                }
            }
        }
1064508
public function deleteBookmark($id)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key']
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 204);

		// Set the API base
		$base = '/v1/people/~/job-bookmarks/' . $id;

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'DELETE', $parameters);

		return $response;
	}
909843
def add_bookmark(request):
    
    if request.method == "POST":
        form = BookmarkForm(user=request.user, data=request.POST)
        if form.is_valid():
            bookmark = form.save()
            if not request.is_ajax():
                messages.success(request, 'Bookmark added')
                if request.POST.get('next'):
                    return HttpResponseRedirect(request.POST.get('next'))
                return HttpResponse('Added')
            return render_to_response(
                'admin_tools/menu/remove_bookmark_form.html',
                {'bookmark': bookmark, 'url': bookmark.url}
            )
    else:
        form = BookmarkForm(user=request.user)
    return render_to_response(
        'admin_tools/menu/form.html',
        {'form': form, 'title': 'Add Bookmark'}
    )
1265262
function paging(res) {
		if ('pagination' in res) {
			res.paging = {
				next: res.pagination.next_url
			};
			delete res.pagination;
		}
	}
823385
function(url, callback) {
      var t = this,
          originalUrl = url,
          page = null;

      // Change urls that end in / to /index
      if (url.substr(-1) === '/') {
        url = url + 'index';
      }

      // Return if it's in cache
      page = pageCache.get(url);
      if (page) {
        return callback(null, page);
      }

      // Read from storage
      page = new Page({id: url});
      page.fetch({liveSync: true, silenceErrors: true}, function(error) {

        // Process a 404.  This returns a transient page copied from
        // the default 404 page, with the id replaced by the specified url.
        if (error && error.code === 'NOTFOUND' && url !== '/app/core/404') {

          // Default the home page if notfound
          if (originalUrl === '/') {
            return t._getPage('/app/core/index', callback);
          }

          // Default the 404 page if notfound
          if (originalUrl === '/404') {
            return t._getPage('/app/core/404', callback);
          }

          // Otherwise it's a new page.  Create it.
          t._getPage('/404', function(error, page404) {
            if (error) {
              console.error("Error loading the 404 page", error);
              return callback('404 page load error');
            }

            // Copy the 404 page into a new page
            var newPage = new Page(JSON.parse(JSON.stringify(page404)));

            // Build a sane starting title.  TitleCase the last url element, separate words, replace underscores
            var title = $.titleCase(url.split('/').pop(), true).replace(/([A-Z])/g," $1").replace(/^ /,'').replace(/_/g,' ');
            var title = url.split('/').pop().replace(/([A-Z])/g," $1").replace(/^ /,'').replace(/_/g,' ');
            newPage.set({id:url, title:title, is404page:true});
            callback(null, newPage);
          });
          return;
        }

        // Process other errors
        if (error) {
          return callback(error);
        }

        // Assure the page model ID is correct on disk
        if (url !== page.get('id')) {
          page.set('id', url);
        }

        // Put the page into cache and return it
        pageCache.add(page);
        return callback(null, page);
      });
    }
1155467
def findBookmark(self, bookmark):
        """"""
        if self.isClosed or self.isEncrypted:
            raise ValueError("operation illegal for closed / encrypted doc")

        return _fitz.Document_findBookmark(self, bookmark)
732822
function()
		{
			var startNode = this.startContainer,
				endNode = this.endContainer;

			if ( startNode.is && startNode.is( 'span' )
				&& startNode.data( 'cke-bookmark' ) )
				this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );
			if ( endNode && endNode.is && endNode.is( 'span' )
				&& endNode.data( 'cke-bookmark' ) )
				this.setEndAt( endNode,  CKEDITOR.POSITION_AFTER_END );
		}
226127
def destroy(self):
        
        logger.info("Destroying page: %s" % self)
        if self.doc.nb_pages <= 1:
            self.doc.destroy()
            return
        doc_pages = self.doc.pages[:]
        current_doc_nb_pages = self.doc.nb_pages
        paths = [
            self.__get_box_path(),
            self.__get_img_path(),
            self._get_thumb_path(),
        ]
        for path in paths:
            if self.fs.exists(path):
                self.fs.unlink(path)
        for page_nb in range(self.page_nb + 1, current_doc_nb_pages):
            page = doc_pages[page_nb]
            page.change_index(offset=-1)
1185737
def delete_tag_from_bookmark(self, bookmark_id, tag_id):
        
        url = self._generate_url('bookmarks/{0}/tags/{1}'.format(
            bookmark_id, tag_id))
        return self.delete(url)
759311
function _handleRelatedDocumentDeleted(url) {
        var liveDoc = _relatedDocuments[url];
        if (liveDoc) {
            delete _relatedDocuments[url];
        }

        if (_server) {
            _server.remove(liveDoc);
        }
        _closeDocument(liveDoc);
    }
1362164
function restoreDefaultBookmarks() {
  // Set up the observer -- we're only checking for success here, so we'll simply
  // time out and throw on failure. It makes the code much clearer than handling
  // finished state and success state separately.
  var importSuccessful = false;
  var importObserver = {
    observe: function (aSubject, aTopic, aData) {
      if (aTopic == TOPIC_BOOKMARKS_RESTORE_SUCCESS) {
        importSuccessful = true;
      }
    }
  }
  observerService.addObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS, false);

  try {
    // Fire off the import
    var bookmarksURI = utils.createURI(BOOKMARKS_RESOURCE);
    var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
                   getService(Ci.nsIPlacesImportExportService);
    importer.importHTMLFromURI(bookmarksURI, true);

    // Wait for it to be finished--the observer above will flip this flag
    mozmill.utils.waitFor(function () {
      return importSuccessful;
    }, "Default bookmarks have finished importing", BOOKMARKS_TIMEOUT);
  }
  finally {
    // Whatever happens, remove the observer afterwards
    observerService.removeObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS);
  }
}
353283
function (callback) {
      var _this = this;

      var guid = _emberMetalUtils.guidFor(this);

      _emberViewsSystemJquery.default(window).on('popstate.ember-location-' + guid, function (e) {
        // Ignore initial page load popstate event in Chrome
        if (!popstateFired) {
          popstateFired = true;
          if (_this.getURL() === _this._previousURL) {
            return;
          }
        }
        callback(_this.getURL());
      });
    }