id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
25,400
box/viewer.js
dist/crocodoc.viewer.js
prepareDOM
function prepareDOM() { var i, pageNum, zoomLevel, maxZoom, ptWidth, ptHeight, pxWidth, pxHeight, pt2px = util.calculatePtSize(), dimensions = config.metadata.dimensions, skeleton = ''; // adjust page scale if the pages are too sma...
javascript
function prepareDOM() { var i, pageNum, zoomLevel, maxZoom, ptWidth, ptHeight, pxWidth, pxHeight, pt2px = util.calculatePtSize(), dimensions = config.metadata.dimensions, skeleton = ''; // adjust page scale if the pages are too sma...
[ "function", "prepareDOM", "(", ")", "{", "var", "i", ",", "pageNum", ",", "zoomLevel", ",", "maxZoom", ",", "ptWidth", ",", "ptHeight", ",", "pxWidth", ",", "pxHeight", ",", "pt2px", "=", "util", ".", "calculatePtSize", "(", ")", ",", "dimensions", "=", ...
Create the html skeleton for the viewer and pages @returns {void} @private
[ "Create", "the", "html", "skeleton", "for", "the", "viewer", "and", "pages" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2578-L2623
25,401
box/viewer.js
dist/crocodoc.viewer.js
createPages
function createPages() { var i, pages = [], page, start = config.pageStart - 1, end = config.pageEnd, links = sortPageLinks(); //initialize pages for (i = start; i < end; i++) { page = scope.createComponent('page'); ...
javascript
function createPages() { var i, pages = [], page, start = config.pageStart - 1, end = config.pageEnd, links = sortPageLinks(); //initialize pages for (i = start; i < end; i++) { page = scope.createComponent('page'); ...
[ "function", "createPages", "(", ")", "{", "var", "i", ",", "pages", "=", "[", "]", ",", "page", ",", "start", "=", "config", ".", "pageStart", "-", "1", ",", "end", "=", "config", ".", "pageEnd", ",", "links", "=", "sortPageLinks", "(", ")", ";", ...
Create and init all necessary page component instances @returns {void} @private
[ "Create", "and", "init", "all", "necessary", "page", "component", "instances" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2643-L2665
25,402
box/viewer.js
dist/crocodoc.viewer.js
sortPageLinks
function sortPageLinks() { var i, len, link, destination, // the starting and ending page *numbers* (not indexes) start = config.pageStart, end = config.pageEnd, links = config.metadata.links || [], sorted = []; // NOTE: //...
javascript
function sortPageLinks() { var i, len, link, destination, // the starting and ending page *numbers* (not indexes) start = config.pageStart, end = config.pageEnd, links = config.metadata.links || [], sorted = []; // NOTE: //...
[ "function", "sortPageLinks", "(", ")", "{", "var", "i", ",", "len", ",", "link", ",", "destination", ",", "// the starting and ending page *numbers* (not indexes)", "start", "=", "config", ".", "pageStart", ",", "end", "=", "config", ".", "pageEnd", ",", "links"...
Returns all links associated with the given page @param {int} page The page @returns {Array} Array of links @private
[ "Returns", "all", "links", "associated", "with", "the", "given", "page" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2673-L2714
25,403
box/viewer.js
dist/crocodoc.viewer.js
updateSelectedPages
function updateSelectedPages() { var node = util.getSelectedNode(); var $page = $(node).closest('.'+CSS_CLASS_PAGE); $el.find('.'+CSS_CLASS_TEXT_SELECTED).removeClass(CSS_CLASS_TEXT_SELECTED); if (node && $el.has(node)) { $page.addClass(CSS_CLASS_TEXT_SELECTED); } ...
javascript
function updateSelectedPages() { var node = util.getSelectedNode(); var $page = $(node).closest('.'+CSS_CLASS_PAGE); $el.find('.'+CSS_CLASS_TEXT_SELECTED).removeClass(CSS_CLASS_TEXT_SELECTED); if (node && $el.has(node)) { $page.addClass(CSS_CLASS_TEXT_SELECTED); } ...
[ "function", "updateSelectedPages", "(", ")", "{", "var", "node", "=", "util", ".", "getSelectedNode", "(", ")", ";", "var", "$page", "=", "$", "(", "node", ")", ".", "closest", "(", "'.'", "+", "CSS_CLASS_PAGE", ")", ";", "$el", ".", "find", "(", "'....
Check if text is selected on any page, and if so, add a css class to that page @returns {void} @TODO(clakenen): this method currently only adds the selected class to one page, so we should modify it to add the class to all pages with selected text @private
[ "Check", "if", "text", "is", "selected", "on", "any", "page", "and", "if", "so", "add", "a", "css", "class", "to", "that", "page" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2732-L2739
25,404
box/viewer.js
dist/crocodoc.viewer.js
handleMousemove
function handleMousemove(event) { $el.scrollTop(downScrollPosition.top - (event.clientY - downMousePosition.y)); $el.scrollLeft(downScrollPosition.left - (event.clientX - downMousePosition.x)); event.preventDefault(); }
javascript
function handleMousemove(event) { $el.scrollTop(downScrollPosition.top - (event.clientY - downMousePosition.y)); $el.scrollLeft(downScrollPosition.left - (event.clientX - downMousePosition.x)); event.preventDefault(); }
[ "function", "handleMousemove", "(", "event", ")", "{", "$el", ".", "scrollTop", "(", "downScrollPosition", ".", "top", "-", "(", "event", ".", "clientY", "-", "downMousePosition", ".", "y", ")", ")", ";", "$el", ".", "scrollLeft", "(", "downScrollPosition", ...
Handle mousemove events @param {Event} event The event object @returns {void}
[ "Handle", "mousemove", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2839-L2843
25,405
box/viewer.js
dist/crocodoc.viewer.js
handleMouseup
function handleMouseup(event) { scope.broadcast('dragend'); $window.off('mousemove', handleMousemove); $window.off('mouseup', handleMouseup); event.preventDefault(); }
javascript
function handleMouseup(event) { scope.broadcast('dragend'); $window.off('mousemove', handleMousemove); $window.off('mouseup', handleMouseup); event.preventDefault(); }
[ "function", "handleMouseup", "(", "event", ")", "{", "scope", ".", "broadcast", "(", "'dragend'", ")", ";", "$window", ".", "off", "(", "'mousemove'", ",", "handleMousemove", ")", ";", "$window", ".", "off", "(", "'mouseup'", ",", "handleMouseup", ")", ";"...
Handle mouseup events @param {Event} event The event object @returns {void}
[ "Handle", "mouseup", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2850-L2855
25,406
box/viewer.js
dist/crocodoc.viewer.js
handleMousedown
function handleMousedown(event) { scope.broadcast('dragstart'); downScrollPosition = { top: $el.scrollTop(), left: $el.scrollLeft() }; downMousePosition = { x: event.clientX, y: event.clientY }; $window.on('mousemove', handl...
javascript
function handleMousedown(event) { scope.broadcast('dragstart'); downScrollPosition = { top: $el.scrollTop(), left: $el.scrollLeft() }; downMousePosition = { x: event.clientX, y: event.clientY }; $window.on('mousemove', handl...
[ "function", "handleMousedown", "(", "event", ")", "{", "scope", ".", "broadcast", "(", "'dragstart'", ")", ";", "downScrollPosition", "=", "{", "top", ":", "$el", ".", "scrollTop", "(", ")", ",", "left", ":", "$el", ".", "scrollLeft", "(", ")", "}", ";...
Handle mousedown events @param {Event} event The event object @returns {void}
[ "Handle", "mousedown", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2862-L2875
25,407
box/viewer.js
dist/crocodoc.viewer.js
function () { var config = scope.getConfig(); this.config = config; // shortcut references to jq DOM objects this.$el = config.$el; this.$doc = config.$doc; this.$viewport = config.$viewport; this.$pages = config.$pages; thi...
javascript
function () { var config = scope.getConfig(); this.config = config; // shortcut references to jq DOM objects this.$el = config.$el; this.$doc = config.$doc; this.$viewport = config.$viewport; this.$pages = config.$pages; thi...
[ "function", "(", ")", "{", "var", "config", "=", "scope", ".", "getConfig", "(", ")", ";", "this", ".", "config", "=", "config", ";", "// shortcut references to jq DOM objects", "this", ".", "$el", "=", "config", ".", "$el", ";", "this", ".", "$doc", "="...
Initialize the Layout component @returns {void}
[ "Initialize", "the", "Layout", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2953-L2968
25,408
box/viewer.js
dist/crocodoc.viewer.js
function () { var viewportEl = this.$viewport[0], dimensionsEl = viewportEl; // use the documentElement for viewport dimensions // if we are using the window as the viewport if (viewportEl === window) { dimensionsEl = document.documentElem...
javascript
function () { var viewportEl = this.$viewport[0], dimensionsEl = viewportEl; // use the documentElement for viewport dimensions // if we are using the window as the viewport if (viewportEl === window) { dimensionsEl = document.documentElem...
[ "function", "(", ")", "{", "var", "viewportEl", "=", "this", ".", "$viewport", "[", "0", "]", ",", "dimensionsEl", "=", "viewportEl", ";", "// use the documentElement for viewport dimensions", "// if we are using the window as the viewport", "if", "(", "viewportEl", "==...
Initalize the state object @returns {void}
[ "Initalize", "the", "state", "object" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L2974-L3004
25,409
box/viewer.js
dist/crocodoc.viewer.js
function (direction) { var i, zoom = false, currentZoom = this.state.zoomState.zoom, zoomLevels = this.zoomLevels; if (direction === Crocodoc.ZOOM_IN) { for (i = 0; i < zoomLevels.length; ++i) { if (zoomLevels[i...
javascript
function (direction) { var i, zoom = false, currentZoom = this.state.zoomState.zoom, zoomLevels = this.zoomLevels; if (direction === Crocodoc.ZOOM_IN) { for (i = 0; i < zoomLevels.length; ++i) { if (zoomLevels[i...
[ "function", "(", "direction", ")", "{", "var", "i", ",", "zoom", "=", "false", ",", "currentZoom", "=", "this", ".", "state", ".", "zoomState", ".", "zoom", ",", "zoomLevels", "=", "this", ".", "zoomLevels", ";", "if", "(", "direction", "===", "Crocodo...
Calculate the next zoom level for zooming in or out @param {string} direction Can be either Crocodoc.ZOOM_IN or Crocodoc.ZOOM_OUT @returns {number|boolean} The next zoom level or false if the viewer cannot be zoomed in the given direction
[ "Calculate", "the", "next", "zoom", "level", "for", "zooming", "in", "or", "out" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3026-L3049
25,410
box/viewer.js
dist/crocodoc.viewer.js
function (left, top) { left = parseInt(left, 10) || 0; top = parseInt(top, 10) || 0; this.scrollToOffset(left + this.state.scrollLeft, top + this.state.scrollTop); }
javascript
function (left, top) { left = parseInt(left, 10) || 0; top = parseInt(top, 10) || 0; this.scrollToOffset(left + this.state.scrollLeft, top + this.state.scrollTop); }
[ "function", "(", "left", ",", "top", ")", "{", "left", "=", "parseInt", "(", "left", ",", "10", ")", "||", "0", ";", "top", "=", "parseInt", "(", "top", ",", "10", ")", "||", "0", ";", "this", ".", "scrollToOffset", "(", "left", "+", "this", "....
Scrolls by the given pixel amount from the current location @param {int} left Left offset to scroll to @param {int} top Top offset to scroll to @returns {void}
[ "Scrolls", "by", "the", "given", "pixel", "amount", "from", "the", "current", "location" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3068-L3072
25,411
box/viewer.js
dist/crocodoc.viewer.js
function () { var prev, page, state = this.state, pages = state.pages; prev = util.bisectRight(pages, state.scrollLeft, 'x0') - 1; page = util.bisectRight(pages, state.scrollLeft + pages[prev].width / 2, 'x0') - 1; return 1 + page; ...
javascript
function () { var prev, page, state = this.state, pages = state.pages; prev = util.bisectRight(pages, state.scrollLeft, 'x0') - 1; page = util.bisectRight(pages, state.scrollLeft + pages[prev].width / 2, 'x0') - 1; return 1 + page; ...
[ "function", "(", ")", "{", "var", "prev", ",", "page", ",", "state", "=", "this", ".", "state", ",", "pages", "=", "state", ".", "pages", ";", "prev", "=", "util", ".", "bisectRight", "(", "pages", ",", "state", ".", "scrollLeft", ",", "'x0'", ")",...
Calculate which page is currently the "focused" page. In horizontal mode, this is the page farthest to the left, where at least half of the page is showing. @returns {int} The current page
[ "Calculate", "which", "page", "is", "currently", "the", "focused", "page", ".", "In", "horizontal", "mode", "this", "is", "the", "page", "farthest", "to", "the", "left", "where", "at", "least", "half", "of", "the", "page", "is", "showing", "." ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3177-L3185
25,412
box/viewer.js
dist/crocodoc.viewer.js
function (val) { var state = this.state, zoom = this.parseZoomValue(val), zoomState = state.zoomState, currentZoom = zoomState.zoom, zoomMode, shouldNotCenter; // update the zoom mode if we landed on a named mode ...
javascript
function (val) { var state = this.state, zoom = this.parseZoomValue(val), zoomState = state.zoomState, currentZoom = zoomState.zoom, zoomMode, shouldNotCenter; // update the zoom mode if we landed on a named mode ...
[ "function", "(", "val", ")", "{", "var", "state", "=", "this", ".", "state", ",", "zoom", "=", "this", ".", "parseZoomValue", "(", "val", ")", ",", "zoomState", "=", "state", ".", "zoomState", ",", "currentZoom", "=", "zoomState", ".", "zoom", ",", "...
Set the zoom level for the layout @param {float|string} val The zoom level (float or one of the zoom constants)
[ "Set", "the", "zoom", "level", "for", "the", "layout" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3391-L3453
25,413
box/viewer.js
dist/crocodoc.viewer.js
function (val) { var zoomVal = parseFloat(val), state = this.state, zoomState = state.zoomState, currentZoom = zoomState.zoom, nextZoom = currentZoom; // number if (zoomVal) { nextZoom = zoomVal; ...
javascript
function (val) { var zoomVal = parseFloat(val), state = this.state, zoomState = state.zoomState, currentZoom = zoomState.zoom, nextZoom = currentZoom; // number if (zoomVal) { nextZoom = zoomVal; ...
[ "function", "(", "val", ")", "{", "var", "zoomVal", "=", "parseFloat", "(", "val", ")", ",", "state", "=", "this", ".", "state", ",", "zoomState", "=", "state", ".", "zoomState", ",", "currentZoom", "=", "zoomState", ".", "zoom", ",", "nextZoom", "=", ...
Parse the given zoom value into a number to zoom to. @param {float|string} val The zoom level (float or one of the zoom constants) @returns {float} The parsed zoom level
[ "Parse", "the", "given", "zoom", "value", "into", "a", "number", "to", "zoom", "to", "." ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3460-L3504
25,414
box/viewer.js
dist/crocodoc.viewer.js
function (val, parsedZoom) { // check if we landed on a named mode switch (parsedZoom) { case this.calculateZoomValue(Crocodoc.ZOOM_AUTO): // if the value passed is a named zoom mode, use that, because // fitheight and fitwidth can sometime...
javascript
function (val, parsedZoom) { // check if we landed on a named mode switch (parsedZoom) { case this.calculateZoomValue(Crocodoc.ZOOM_AUTO): // if the value passed is a named zoom mode, use that, because // fitheight and fitwidth can sometime...
[ "function", "(", "val", ",", "parsedZoom", ")", "{", "// check if we landed on a named mode", "switch", "(", "parsedZoom", ")", "{", "case", "this", ".", "calculateZoomValue", "(", "Crocodoc", ".", "ZOOM_AUTO", ")", ":", "// if the value passed is a named zoom mode, use...
Calculates the new zoomMode given the input val and the parsed zoom value @param {float|string} val The input zoom value @param {float} parsedZoom The parsed zoom value @returns {string|null} The new zoom move
[ "Calculates", "the", "new", "zoomMode", "given", "the", "input", "val", "and", "the", "parsed", "zoom", "value" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3512-L3531
25,415
box/viewer.js
dist/crocodoc.viewer.js
function () { var i, lastZoomLevel, zoomLevels = this.config.zoomLevels.slice() || [1], auto = this.calculateZoomValue(Crocodoc.ZOOM_AUTO), fitWidth = this.calculateZoomValue(Crocodoc.ZOOM_FIT_WIDTH), fitHeight = this.calculateZoomValue(Crocodo...
javascript
function () { var i, lastZoomLevel, zoomLevels = this.config.zoomLevels.slice() || [1], auto = this.calculateZoomValue(Crocodoc.ZOOM_AUTO), fitWidth = this.calculateZoomValue(Crocodoc.ZOOM_FIT_WIDTH), fitHeight = this.calculateZoomValue(Crocodo...
[ "function", "(", ")", "{", "var", "i", ",", "lastZoomLevel", ",", "zoomLevels", "=", "this", ".", "config", ".", "zoomLevels", ".", "slice", "(", ")", "||", "[", "1", "]", ",", "auto", "=", "this", ".", "calculateZoomValue", "(", "Crocodoc", ".", "ZO...
Update zoom levels and the min and max zoom @returns {void}
[ "Update", "zoom", "levels", "and", "the", "min", "and", "max", "zoom" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3537-L3604
25,416
box/viewer.js
dist/crocodoc.viewer.js
shouldUseZoomLevel
function shouldUseZoomLevel(zoomLevel) { var similarity = lastZoomLevel / zoomLevel; // remove duplicates if (zoomLevel === lastZoomLevel) { return false; } // keep anything that is within the similarity threshold ...
javascript
function shouldUseZoomLevel(zoomLevel) { var similarity = lastZoomLevel / zoomLevel; // remove duplicates if (zoomLevel === lastZoomLevel) { return false; } // keep anything that is within the similarity threshold ...
[ "function", "shouldUseZoomLevel", "(", "zoomLevel", ")", "{", "var", "similarity", "=", "lastZoomLevel", "/", "zoomLevel", ";", "// remove duplicates", "if", "(", "zoomLevel", "===", "lastZoomLevel", ")", "{", "return", "false", ";", "}", "// keep anything that is w...
Return true if we should use this zoom level @param {number} zoomLevel The zoom level to consider @returns {boolean} True if we should keep this level @private
[ "Return", "true", "if", "we", "should", "use", "this", "zoom", "level" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3570-L3588
25,417
box/viewer.js
dist/crocodoc.viewer.js
function (pageNum) { var index = util.clamp(pageNum - 1, 0, this.numPages - 1), page = this.state.pages[index]; return { top: page.y0, left: page.x0 }; }
javascript
function (pageNum) { var index = util.clamp(pageNum - 1, 0, this.numPages - 1), page = this.state.pages[index]; return { top: page.y0, left: page.x0 }; }
[ "function", "(", "pageNum", ")", "{", "var", "index", "=", "util", ".", "clamp", "(", "pageNum", "-", "1", ",", "0", ",", "this", ".", "numPages", "-", "1", ")", ",", "page", "=", "this", ".", "state", ".", "pages", "[", "index", "]", ";", "ret...
Given a page number, return an object with top and left properties of the scroll position for that page @param {int} pageNum The page number @returns {Object} The scroll position object
[ "Given", "a", "page", "number", "return", "an", "object", "with", "top", "and", "left", "properties", "of", "the", "scroll", "position", "for", "that", "page" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3692-L3696
25,418
box/viewer.js
dist/crocodoc.viewer.js
function (page) { var state = this.state; if (state.currentPage !== page) { // page has changed state.currentPage = page; this.updateVisiblePages(); scope.broadcast('pagefocus', { page: state.currentPage, ...
javascript
function (page) { var state = this.state; if (state.currentPage !== page) { // page has changed state.currentPage = page; this.updateVisiblePages(); scope.broadcast('pagefocus', { page: state.currentPage, ...
[ "function", "(", "page", ")", "{", "var", "state", "=", "this", ".", "state", ";", "if", "(", "state", ".", "currentPage", "!==", "page", ")", "{", "// page has changed", "state", ".", "currentPage", "=", "page", ";", "this", ".", "updateVisiblePages", "...
Set the current page, update the visible pages, and broadcast a pagefocus message if the given page is not already the current page @param {int} page The page number
[ "Set", "the", "current", "page", "update", "the", "visible", "pages", "and", "broadcast", "a", "pagefocus", "message", "if", "the", "given", "page", "is", "not", "already", "the", "current", "page" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3773-L3789
25,419
box/viewer.js
dist/crocodoc.viewer.js
function (updateClasses) { var i, len, $page, state = this.state, visibleRange = this.calculateVisibleRange(), fullyVisibleRange = this.calculateFullyVisibleRange(); state.visiblePages.length = 0; state.fullyVisiblePages.length = 0; ...
javascript
function (updateClasses) { var i, len, $page, state = this.state, visibleRange = this.calculateVisibleRange(), fullyVisibleRange = this.calculateFullyVisibleRange(); state.visiblePages.length = 0; state.fullyVisiblePages.length = 0; ...
[ "function", "(", "updateClasses", ")", "{", "var", "i", ",", "len", ",", "$page", ",", "state", "=", "this", ".", "state", ",", "visibleRange", "=", "this", ".", "calculateVisibleRange", "(", ")", ",", "fullyVisibleRange", "=", "this", ".", "calculateFully...
Calculate and update which pages are visible, possibly updating CSS classes on the pages @param {boolean} updateClasses Wheter to update page CSS classes as well @returns {void}
[ "Calculate", "and", "update", "which", "pages", "are", "visible", "possibly", "updating", "CSS", "classes", "on", "the", "pages" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3797-L3820
25,420
box/viewer.js
dist/crocodoc.viewer.js
function (data) { var zoomMode = this.state.zoomState.zoomMode; this.state.viewportDimensions = data; this.updateZoomLevels(); this.setZoom(zoomMode); }
javascript
function (data) { var zoomMode = this.state.zoomState.zoomMode; this.state.viewportDimensions = data; this.updateZoomLevels(); this.setZoom(zoomMode); }
[ "function", "(", "data", ")", "{", "var", "zoomMode", "=", "this", ".", "state", ".", "zoomState", ".", "zoomMode", ";", "this", ".", "state", ".", "viewportDimensions", "=", "data", ";", "this", ".", "updateZoomLevels", "(", ")", ";", "this", ".", "se...
Handle resize messages @param {Object} data Object containing width and height of the viewport @returns {void}
[ "Handle", "resize", "messages" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3936-L3941
25,421
box/viewer.js
dist/crocodoc.viewer.js
function (shouldNotCenter) { var state = this.state, zoomState = state.zoomState, ratio = zoomState.zoom / zoomState.prevZoom, newScrollLeft, newScrollTop; // update scroll position newScrollLeft = state.scrollLeft * ratio; ...
javascript
function (shouldNotCenter) { var state = this.state, zoomState = state.zoomState, ratio = zoomState.zoom / zoomState.prevZoom, newScrollLeft, newScrollTop; // update scroll position newScrollLeft = state.scrollLeft * ratio; ...
[ "function", "(", "shouldNotCenter", ")", "{", "var", "state", "=", "this", ".", "state", ",", "zoomState", "=", "state", ".", "zoomState", ",", "ratio", "=", "zoomState", ".", "zoom", "/", "zoomState", ".", "prevZoom", ",", "newScrollLeft", ",", "newScroll...
Update the scroll position after a zoom @param {bool} shouldNotCenter Whether or not the scroll position should be updated to center the new zoom level @returns {void}
[ "Update", "the", "scroll", "position", "after", "a", "zoom" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L3963-L3981
25,422
box/viewer.js
dist/crocodoc.viewer.js
function (page) { var index = util.clamp(page - 1, 0, this.numPages), $precedingPage, $currentPage; paged.setCurrentPage.call(this, page); // update CSS classes this.$doc.find('.' + CSS_CLASS_PRECEDING_PAGE) .removeClass(C...
javascript
function (page) { var index = util.clamp(page - 1, 0, this.numPages), $precedingPage, $currentPage; paged.setCurrentPage.call(this, page); // update CSS classes this.$doc.find('.' + CSS_CLASS_PRECEDING_PAGE) .removeClass(C...
[ "function", "(", "page", ")", "{", "var", "index", "=", "util", ".", "clamp", "(", "page", "-", "1", ",", "0", ",", "this", ".", "numPages", ")", ",", "$precedingPage", ",", "$currentPage", ";", "paged", ".", "setCurrentPage", ".", "call", "(", "this...
Set the current page and updatePageClasses @param {int} page The page number
[ "Set", "the", "current", "page", "and", "updatePageClasses" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4174-L4197
25,423
box/viewer.js
dist/crocodoc.viewer.js
function () { var i, len, page, $page, width, height, left, top, paddingH, state = this.state, viewportWidth = state.viewportDimensions.clientWidth, viewportHeight = state.viewportDimensions.clientHeight; // update pages so they are...
javascript
function () { var i, len, page, $page, width, height, left, top, paddingH, state = this.state, viewportWidth = state.viewportDimensions.clientWidth, viewportHeight = state.viewportDimensions.clientHeight; // update pages so they are...
[ "function", "(", ")", "{", "var", "i", ",", "len", ",", "page", ",", "$page", ",", "width", ",", "height", ",", "left", ",", "top", ",", "paddingH", ",", "state", "=", "this", ".", "state", ",", "viewportWidth", "=", "state", ".", "viewportDimensions...
Update page margins for the viewport size and zoom level @returns {void}
[ "Update", "page", "margins", "for", "the", "viewport", "size", "and", "zoom", "level" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4256-L4291
25,424
box/viewer.js
dist/crocodoc.viewer.js
function () { var $pages = this.$pages, index = this.state.currentPage - 1, next = index + 1, prev = index - 1, buffer = 20; // @TODO: optimize this a bit // add/removeClass is expensive, so try using hasClass ...
javascript
function () { var $pages = this.$pages, index = this.state.currentPage - 1, next = index + 1, prev = index - 1, buffer = 20; // @TODO: optimize this a bit // add/removeClass is expensive, so try using hasClass ...
[ "function", "(", ")", "{", "var", "$pages", "=", "this", ".", "$pages", ",", "index", "=", "this", ".", "state", ".", "currentPage", "-", "1", ",", "next", "=", "index", "+", "1", ",", "prev", "=", "index", "-", "1", ",", "buffer", "=", "20", "...
Update page classes for presentation mode transitions @returns {void}
[ "Update", "page", "classes", "for", "presentation", "mode", "transitions" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4297-L4367
25,425
box/viewer.js
dist/crocodoc.viewer.js
pageLoadLoop
function pageLoadLoop() { var index; clearTimeout(pageLoadTID); if (pageLoadQueue.length > 0) { // found a page to load index = pageLoadQueue.shift(); // page exists and not reached max errors? if (pages[index]) { api.loadPage(index...
javascript
function pageLoadLoop() { var index; clearTimeout(pageLoadTID); if (pageLoadQueue.length > 0) { // found a page to load index = pageLoadQueue.shift(); // page exists and not reached max errors? if (pages[index]) { api.loadPage(index...
[ "function", "pageLoadLoop", "(", ")", "{", "var", "index", ";", "clearTimeout", "(", "pageLoadTID", ")", ";", "if", "(", "pageLoadQueue", ".", "length", ">", "0", ")", "{", "// found a page to load", "index", "=", "pageLoadQueue", ".", "shift", "(", ")", "...
Loop through the pageLoadQueue and load pages sequentially, setting a timeout to run again after PAGE_LOAD_INTERVAL ms until the queue is empty @returns {void} @private
[ "Loop", "through", "the", "pageLoadQueue", "and", "load", "pages", "sequentially", "setting", "a", "timeout", "to", "run", "again", "after", "PAGE_LOAD_INTERVAL", "ms", "until", "the", "queue", "is", "empty" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4633-L4655
25,426
box/viewer.js
dist/crocodoc.viewer.js
indexInRange
function indexInRange(index, rangeLength) { var range = calculateRange(rangeLength); if (index >= range.min && index <= range.max) { return true; } return false; }
javascript
function indexInRange(index, rangeLength) { var range = calculateRange(rangeLength); if (index >= range.min && index <= range.max) { return true; } return false; }
[ "function", "indexInRange", "(", "index", ",", "rangeLength", ")", "{", "var", "range", "=", "calculateRange", "(", "rangeLength", ")", ";", "if", "(", "index", ">=", "range", ".", "min", "&&", "index", "<=", "range", ".", "max", ")", "{", "return", "t...
Returns true if the given index is in the page load range, and false otherwise @param {int} index The page index @param {int} rangeLength The page range length @returns {bool} Whether the page index is in the page load range @private
[ "Returns", "true", "if", "the", "given", "index", "is", "in", "the", "page", "load", "range", "and", "false", "otherwise" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4709-L4715
25,427
box/viewer.js
dist/crocodoc.viewer.js
shouldLoadPage
function shouldLoadPage(index) { var page = pages[index]; // does the page exist? if (page) { // within page load range? if (indexInRange(index)) { return true; } // is it visible? if (pageIsVisible(index)) { ...
javascript
function shouldLoadPage(index) { var page = pages[index]; // does the page exist? if (page) { // within page load range? if (indexInRange(index)) { return true; } // is it visible? if (pageIsVisible(index)) { ...
[ "function", "shouldLoadPage", "(", "index", ")", "{", "var", "page", "=", "pages", "[", "index", "]", ";", "// does the page exist?", "if", "(", "page", ")", "{", "// within page load range?", "if", "(", "indexInRange", "(", "index", ")", ")", "{", "return",...
Returns true if the given page index should be loaded, and false otherwise @param {int} index The page index @returns {bool} Whether the page should be loaded @private
[ "Returns", "true", "if", "the", "given", "page", "index", "should", "be", "loaded", "and", "false", "otherwise" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4723-L4741
25,428
box/viewer.js
dist/crocodoc.viewer.js
shouldUnloadPage
function shouldUnloadPage(index, rangeLength) { // within page load range? if (indexInRange(index, rangeLength)) { return false; } // is it visible? if (pageIsVisible(index)) { return false; } return true; }
javascript
function shouldUnloadPage(index, rangeLength) { // within page load range? if (indexInRange(index, rangeLength)) { return false; } // is it visible? if (pageIsVisible(index)) { return false; } return true; }
[ "function", "shouldUnloadPage", "(", "index", ",", "rangeLength", ")", "{", "// within page load range?", "if", "(", "indexInRange", "(", "index", ",", "rangeLength", ")", ")", "{", "return", "false", ";", "}", "// is it visible?", "if", "(", "pageIsVisible", "(...
Returns true if the given page index should be unloaded, and false otherwise @param {int} index The page index @param {int} rangeLength The range length @returns {bool} Whether the page should be unloaded @private
[ "Returns", "true", "if", "the", "given", "page", "index", "should", "be", "unloaded", "and", "false", "otherwise" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4750-L4763
25,429
box/viewer.js
dist/crocodoc.viewer.js
queuePagesToLoadInOrder
function queuePagesToLoadInOrder(start, end) { var increment = util.sign(end - start); while (start !== end) { api.queuePageToLoad(start); start += increment; } api.queuePageToLoad(start); }
javascript
function queuePagesToLoadInOrder(start, end) { var increment = util.sign(end - start); while (start !== end) { api.queuePageToLoad(start); start += increment; } api.queuePageToLoad(start); }
[ "function", "queuePagesToLoadInOrder", "(", "start", ",", "end", ")", "{", "var", "increment", "=", "util", ".", "sign", "(", "end", "-", "start", ")", ";", "while", "(", "start", "!==", "end", ")", "{", "api", ".", "queuePageToLoad", "(", "start", ")"...
Queues pages to load in order from indexFrom to indexTo @param {number} start The page index to start at @param {number} end The page index to end at @returns {void}
[ "Queues", "pages", "to", "load", "in", "order", "from", "indexFrom", "to", "indexTo" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4782-L4790
25,430
box/viewer.js
dist/crocodoc.viewer.js
function (pageComponents) { pages = pageComponents; numPages = pages.length; pageLoadRange = (browser.mobile || browser.ielt10) ? MAX_PAGE_LOAD_RANGE_MOBILE : MAX_PAGE_LOAD_RANGE; pageLoadRange = Math.min(pageLoadRange, numPages); }
javascript
function (pageComponents) { pages = pageComponents; numPages = pages.length; pageLoadRange = (browser.mobile || browser.ielt10) ? MAX_PAGE_LOAD_RANGE_MOBILE : MAX_PAGE_LOAD_RANGE; pageLoadRange = Math.min(pageLoadRange, numPages); }
[ "function", "(", "pageComponents", ")", "{", "pages", "=", "pageComponents", ";", "numPages", "=", "pages", ".", "length", ";", "pageLoadRange", "=", "(", "browser", ".", "mobile", "||", "browser", ".", "ielt10", ")", "?", "MAX_PAGE_LOAD_RANGE_MOBILE", ":", ...
Initialize the LazyLoader component @param {Array} pageComponents The array of page components to lazily load @returns {void}
[ "Initialize", "the", "LazyLoader", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4845-L4852
25,431
box/viewer.js
dist/crocodoc.viewer.js
function (state) { scrollDirection = util.sign(state.page - layoutState.page); layoutState = state; }
javascript
function (state) { scrollDirection = util.sign(state.page - layoutState.page); layoutState = state; }
[ "function", "(", "state", ")", "{", "scrollDirection", "=", "util", ".", "sign", "(", "state", ".", "page", "-", "layoutState", ".", "page", ")", ";", "layoutState", "=", "state", ";", "}" ]
Updates the current layout state and scroll direction @param {Object} state The layout state @returns {void}
[ "Updates", "the", "current", "layout", "state", "and", "scroll", "direction" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4867-L4870
25,432
box/viewer.js
dist/crocodoc.viewer.js
function (range) { var currentIndex = layoutState.page - 1; if (range > 0) { range = calculateRange(range); // load pages in the order of priority based on the direction // the user is scrolling (load nearest page first, working in ...
javascript
function (range) { var currentIndex = layoutState.page - 1; if (range > 0) { range = calculateRange(range); // load pages in the order of priority based on the direction // the user is scrolling (load nearest page first, working in ...
[ "function", "(", "range", ")", "{", "var", "currentIndex", "=", "layoutState", ".", "page", "-", "1", ";", "if", "(", "range", ">", "0", ")", "{", "range", "=", "calculateRange", "(", "range", ")", ";", "// load pages in the order of priority based on the dire...
Queue pages to load within the given range such that proceeding pages are added before preceding pages @param {int} range The range to load beyond the current page @returns {void}
[ "Queue", "pages", "to", "load", "within", "the", "given", "range", "such", "that", "proceeding", "pages", "are", "added", "before", "preceding", "pages" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4901-L4919
25,433
box/viewer.js
dist/crocodoc.viewer.js
function () { var i, len; for (i = 0, len = layoutState.visiblePages.length; i < len; ++i) { this.queuePageToLoad(layoutState.visiblePages[i] - 1); } }
javascript
function () { var i, len; for (i = 0, len = layoutState.visiblePages.length; i < len; ++i) { this.queuePageToLoad(layoutState.visiblePages[i] - 1); } }
[ "function", "(", ")", "{", "var", "i", ",", "len", ";", "for", "(", "i", "=", "0", ",", "len", "=", "layoutState", ".", "visiblePages", ".", "length", ";", "i", "<", "len", ";", "++", "i", ")", "{", "this", ".", "queuePageToLoad", "(", "layoutSta...
Queue to load all pages that are visible according to the current layoutState @returns {void}
[ "Queue", "to", "load", "all", "pages", "that", "are", "visible", "according", "to", "the", "current", "layoutState" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4926-L4931
25,434
box/viewer.js
dist/crocodoc.viewer.js
function (index, callback) { $.when(pages[index] && pages[index].load()) .always(callback); }
javascript
function (index, callback) { $.when(pages[index] && pages[index].load()) .always(callback); }
[ "function", "(", "index", ",", "callback", ")", "{", "$", ".", "when", "(", "pages", "[", "index", "]", "&&", "pages", "[", "index", "]", ".", "load", "(", ")", ")", ".", "always", "(", "callback", ")", ";", "}" ]
Call the load method on the page object at the specified index @param {int} index The index of the page to load @param {Function} callback Callback function to call always (regardless of page load success/fail) @returns {void}
[ "Call", "the", "load", "method", "on", "the", "page", "object", "at", "the", "specified", "index" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L4962-L4965
25,435
box/viewer.js
dist/crocodoc.viewer.js
function (data) { if (!ready) { return; } var i; if (data.all === true) { data.upto = numPages; } if (data.page) { this.queuePageToLoad(data.page - 1); } else if (data.upto) { ...
javascript
function (data) { if (!ready) { return; } var i; if (data.all === true) { data.upto = numPages; } if (data.page) { this.queuePageToLoad(data.page - 1); } else if (data.upto) { ...
[ "function", "(", "data", ")", "{", "if", "(", "!", "ready", ")", "{", "return", ";", "}", "var", "i", ";", "if", "(", "data", ".", "all", "===", "true", ")", "{", "data", ".", "upto", "=", "numPages", ";", "}", "if", "(", "data", ".", "page",...
Handle pageavailable messages @param {Object} data The message data @returns {void}
[ "Handle", "pageavailable", "messages" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5011-L5026
25,436
box/viewer.js
dist/crocodoc.viewer.js
function () { this.preload(); $loadImgPromise.done(function loadImgSuccess(img) { if (!imageLoaded) { imageLoaded = true; $img = $(img).appendTo($el); } }); $loadImgPromise.fail(function loadImgFail...
javascript
function () { this.preload(); $loadImgPromise.done(function loadImgSuccess(img) { if (!imageLoaded) { imageLoaded = true; $img = $(img).appendTo($el); } }); $loadImgPromise.fail(function loadImgFail...
[ "function", "(", ")", "{", "this", ".", "preload", "(", ")", ";", "$loadImgPromise", ".", "done", "(", "function", "loadImgSuccess", "(", "img", ")", "{", "if", "(", "!", "imageLoaded", ")", "{", "imageLoaded", "=", "true", ";", "$img", "=", "$", "("...
Load the image @returns {$.Promise} A jQuery Promise object
[ "Load", "the", "image" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5167-L5185
25,437
box/viewer.js
dist/crocodoc.viewer.js
createLink
function createLink(link) { var $link = $('<a>').addClass(CSS_CLASS_PAGE_LINK), left = link.bbox[0], top = link.bbox[1], attr = {}; if (browser.ie) { // @NOTE: IE doesn't allow override of ctrl+click on anchor tags, // but there is a workaroun...
javascript
function createLink(link) { var $link = $('<a>').addClass(CSS_CLASS_PAGE_LINK), left = link.bbox[0], top = link.bbox[1], attr = {}; if (browser.ie) { // @NOTE: IE doesn't allow override of ctrl+click on anchor tags, // but there is a workaroun...
[ "function", "createLink", "(", "link", ")", "{", "var", "$link", "=", "$", "(", "'<a>'", ")", ".", "addClass", "(", "CSS_CLASS_PAGE_LINK", ")", ",", "left", "=", "link", ".", "bbox", "[", "0", "]", ",", "top", "=", "link", ".", "bbox", "[", "1", ...
Create a link element given link data @param {Object} link The link data @returns {void} @private
[ "Create", "a", "link", "element", "given", "link", "data" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5227-L5265
25,438
box/viewer.js
dist/crocodoc.viewer.js
handleClick
function handleClick(event) { var targetEl = browser.ie ? event.target.parentNode : event.target, $link = $(targetEl), data = $link.data('link'); if (data) { scope.broadcast('linkclick', data); } event.preventDefault(); }
javascript
function handleClick(event) { var targetEl = browser.ie ? event.target.parentNode : event.target, $link = $(targetEl), data = $link.data('link'); if (data) { scope.broadcast('linkclick', data); } event.preventDefault(); }
[ "function", "handleClick", "(", "event", ")", "{", "var", "targetEl", "=", "browser", ".", "ie", "?", "event", ".", "target", ".", "parentNode", ":", "event", ".", "target", ",", "$link", "=", "$", "(", "targetEl", ")", ",", "data", "=", "$link", "."...
Handle link clicks @param {Event} event The event object @returns {void} @private
[ "Handle", "link", "clicks" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5273-L5282
25,439
box/viewer.js
dist/crocodoc.viewer.js
function (el, links) { $el = $(el); this.createLinks(links); if (!browser.ie) { // @NOTE: event handlers are individually bound in IE, because // the ctrl+click workaround fails when using event delegation $el.on('click', '.' + CSS_CLAS...
javascript
function (el, links) { $el = $(el); this.createLinks(links); if (!browser.ie) { // @NOTE: event handlers are individually bound in IE, because // the ctrl+click workaround fails when using event delegation $el.on('click', '.' + CSS_CLAS...
[ "function", "(", "el", ",", "links", ")", "{", "$el", "=", "$", "(", "el", ")", ";", "this", ".", "createLinks", "(", "links", ")", ";", "if", "(", "!", "browser", ".", "ie", ")", "{", "// @NOTE: event handlers are individually bound in IE, because", "// t...
Initialize the page-links component @param {Array} links Links configuration array @returns {void} @TODO (possible): make a links data-provider instead of passing them in as an argument?
[ "Initialize", "the", "page", "-", "links", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5296-L5304
25,440
box/viewer.js
dist/crocodoc.viewer.js
function (links) { var i, len; for (i = 0, len = links.length; i < len; ++i) { createLink(links[i]); } }
javascript
function (links) { var i, len; for (i = 0, len = links.length; i < len; ++i) { createLink(links[i]); } }
[ "function", "(", "links", ")", "{", "var", "i", ",", "len", ";", "for", "(", "i", "=", "0", ",", "len", "=", "links", ".", "length", ";", "i", "<", "len", ";", "++", "i", ")", "{", "createLink", "(", "links", "[", "i", "]", ")", ";", "}", ...
Create and insert link elements into the element @param {Array} links Array of link data @returns {void}
[ "Create", "and", "insert", "link", "elements", "into", "the", "element" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5322-L5327
25,441
box/viewer.js
dist/crocodoc.viewer.js
createSVGEl
function createSVGEl() { switch (embedStrategy) { case EMBED_STRATEGY_IFRAME_INNERHTML: case EMBED_STRATEGY_IFRAME_PROXY: return $('<iframe>'); case EMBED_STRATEGY_DATA_URL_PROXY: case EMBED_STRATEGY_DATA_URL: return $('<object>')....
javascript
function createSVGEl() { switch (embedStrategy) { case EMBED_STRATEGY_IFRAME_INNERHTML: case EMBED_STRATEGY_IFRAME_PROXY: return $('<iframe>'); case EMBED_STRATEGY_DATA_URL_PROXY: case EMBED_STRATEGY_DATA_URL: return $('<object>')....
[ "function", "createSVGEl", "(", ")", "{", "switch", "(", "embedStrategy", ")", "{", "case", "EMBED_STRATEGY_IFRAME_INNERHTML", ":", "case", "EMBED_STRATEGY_IFRAME_PROXY", ":", "return", "$", "(", "'<iframe>'", ")", ";", "case", "EMBED_STRATEGY_DATA_URL_PROXY", ":", ...
Create and return a jQuery object for the SVG element @returns {Object} The SVG $element @private
[ "Create", "and", "return", "a", "jQuery", "object", "for", "the", "SVG", "element" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5365-L5390
25,442
box/viewer.js
dist/crocodoc.viewer.js
loadSVGText
function loadSVGText() { if (svgLoaded || // @NOTE: these embed strategies don't require svg text to be loaded embedStrategy === EMBED_STRATEGY_BASIC_OBJECT || embedStrategy === EMBED_STRATEGY_BASIC_IMG) { // don't load the SVG text, just return an empty p...
javascript
function loadSVGText() { if (svgLoaded || // @NOTE: these embed strategies don't require svg text to be loaded embedStrategy === EMBED_STRATEGY_BASIC_OBJECT || embedStrategy === EMBED_STRATEGY_BASIC_IMG) { // don't load the SVG text, just return an empty p...
[ "function", "loadSVGText", "(", ")", "{", "if", "(", "svgLoaded", "||", "// @NOTE: these embed strategies don't require svg text to be loaded", "embedStrategy", "===", "EMBED_STRATEGY_BASIC_OBJECT", "||", "embedStrategy", "===", "EMBED_STRATEGY_BASIC_IMG", ")", "{", "// don't l...
Load svg text if necessary @returns {$.Promise} @private
[ "Load", "svg", "text", "if", "necessary" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5413-L5426
25,443
box/viewer.js
dist/crocodoc.viewer.js
loadSVGSuccess
function loadSVGSuccess(text) { if (!destroyed && !unloaded) { if (!svgLoaded && text) { embedSVG(text); svgLoaded = true; if (!removeOnUnload) { // cleanup the promise (abort will remove the svg text from // the...
javascript
function loadSVGSuccess(text) { if (!destroyed && !unloaded) { if (!svgLoaded && text) { embedSVG(text); svgLoaded = true; if (!removeOnUnload) { // cleanup the promise (abort will remove the svg text from // the...
[ "function", "loadSVGSuccess", "(", "text", ")", "{", "if", "(", "!", "destroyed", "&&", "!", "unloaded", ")", "{", "if", "(", "!", "svgLoaded", "&&", "text", ")", "{", "embedSVG", "(", "text", ")", ";", "svgLoaded", "=", "true", ";", "if", "(", "!"...
handle SVG load success @param {string} text The SVG text @returns {void}
[ "handle", "SVG", "load", "success" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5569-L5586
25,444
box/viewer.js
dist/crocodoc.viewer.js
function () { unloaded = true; // stop loading the page if it hasn't finished yet if ($loadSVGPromise && $loadSVGPromise.state() !== 'resolved') { $loadSVGPromise.abort(); $loadSVGPromise = null; } // remove the svg element if ...
javascript
function () { unloaded = true; // stop loading the page if it hasn't finished yet if ($loadSVGPromise && $loadSVGPromise.state() !== 'resolved') { $loadSVGPromise.abort(); $loadSVGPromise = null; } // remove the svg element if ...
[ "function", "(", ")", "{", "unloaded", "=", "true", ";", "// stop loading the page if it hasn't finished yet", "if", "(", "$loadSVGPromise", "&&", "$loadSVGPromise", ".", "state", "(", ")", "!==", "'resolved'", ")", "{", "$loadSVGPromise", ".", "abort", "(", ")", ...
Unload the SVG object if necessary @returns {void}
[ "Unload", "the", "SVG", "object", "if", "necessary" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5671-L5687
25,445
box/viewer.js
dist/crocodoc.viewer.js
loadTextLayerHTMLSuccess
function loadTextLayerHTMLSuccess(text) { var doc, textEl; if (!text || loaded || destroyed) { return; } loaded = true; // create a document to parse the html text doc = document.implementation.createHTMLDocument(''); doc.getElementsByTagName('body'...
javascript
function loadTextLayerHTMLSuccess(text) { var doc, textEl; if (!text || loaded || destroyed) { return; } loaded = true; // create a document to parse the html text doc = document.implementation.createHTMLDocument(''); doc.getElementsByTagName('body'...
[ "function", "loadTextLayerHTMLSuccess", "(", "text", ")", "{", "var", "doc", ",", "textEl", ";", "if", "(", "!", "text", "||", "loaded", "||", "destroyed", ")", "{", "return", ";", "}", "loaded", "=", "true", ";", "// create a document to parse the html text",...
Handle success loading HTML text @param {string} text The HTML text @returns {void} @private
[ "Handle", "success", "loading", "HTML", "text" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5727-L5746
25,446
box/viewer.js
dist/crocodoc.viewer.js
function ($pageEl, config) { var $text, $svg, $links; $el = $pageEl; $svg = $pageEl.find('.' + CSS_CLASS_PAGE_SVG); $text = $pageEl.find('.' + CSS_CLASS_PAGE_TEXT); $links = $pageEl.find('.' + CSS_CLASS_PAGE_LINKS); status = config.status || PAGE_...
javascript
function ($pageEl, config) { var $text, $svg, $links; $el = $pageEl; $svg = $pageEl.find('.' + CSS_CLASS_PAGE_SVG); $text = $pageEl.find('.' + CSS_CLASS_PAGE_TEXT); $links = $pageEl.find('.' + CSS_CLASS_PAGE_LINKS); status = config.status || PAGE_...
[ "function", "(", "$pageEl", ",", "config", ")", "{", "var", "$text", ",", "$svg", ",", "$links", ";", "$el", "=", "$pageEl", ";", "$svg", "=", "$pageEl", ".", "find", "(", "'.'", "+", "CSS_CLASS_PAGE_SVG", ")", ";", "$text", "=", "$pageEl", ".", "fin...
Initialize the Page component @returns {void}
[ "Initialize", "the", "Page", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5917-L5945
25,447
box/viewer.js
dist/crocodoc.viewer.js
function () { var pageComponent = this; loadRequested = true; // the page has failed to load for good... don't try anymore if (status === PAGE_STATUS_ERROR) { return false; } // don't actually load if the page is converting ...
javascript
function () { var pageComponent = this; loadRequested = true; // the page has failed to load for good... don't try anymore if (status === PAGE_STATUS_ERROR) { return false; } // don't actually load if the page is converting ...
[ "function", "(", ")", "{", "var", "pageComponent", "=", "this", ";", "loadRequested", "=", "true", ";", "// the page has failed to load for good... don't try anymore", "if", "(", "status", "===", "PAGE_STATUS_ERROR", ")", "{", "return", "false", ";", "}", "// don't ...
Load and show SVG and text assets for this page @returns {$.Promise} jQuery Promise object or false if the page is not loading
[ "Load", "and", "show", "SVG", "and", "text", "assets", "for", "this", "page" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L5971-L6008
25,448
box/viewer.js
dist/crocodoc.viewer.js
broadcast
function broadcast() { scope.broadcast('resize', { // shortcuts for offsetWidth/height width: currentOffsetWidth, height: currentOffsetHeight, // client width is width of the inner, visible area clientWidth: currentClientWidth, clientHeight...
javascript
function broadcast() { scope.broadcast('resize', { // shortcuts for offsetWidth/height width: currentOffsetWidth, height: currentOffsetHeight, // client width is width of the inner, visible area clientWidth: currentClientWidth, clientHeight...
[ "function", "broadcast", "(", ")", "{", "scope", ".", "broadcast", "(", "'resize'", ",", "{", "// shortcuts for offsetWidth/height", "width", ":", "currentOffsetWidth", ",", "height", ":", "currentOffsetHeight", ",", "// client width is width of the inner, visible area", ...
Fire the resize event with the proper data @returns {void} @private
[ "Fire", "the", "resize", "event", "with", "the", "proper", "data" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6086-L6099
25,449
box/viewer.js
dist/crocodoc.viewer.js
initResizer
function initResizer() { var $iframe = $('<iframe frameborder="0">'), $div = $('<div>'); $iframe.add($div).css({ opacity: 0, visiblility: 'hidden', position: 'absolute', width: '100%', height: '100%', top: 0, ...
javascript
function initResizer() { var $iframe = $('<iframe frameborder="0">'), $div = $('<div>'); $iframe.add($div).css({ opacity: 0, visiblility: 'hidden', position: 'absolute', width: '100%', height: '100%', top: 0, ...
[ "function", "initResizer", "(", ")", "{", "var", "$iframe", "=", "$", "(", "'<iframe frameborder=\"0\">'", ")", ",", "$div", "=", "$", "(", "'<div>'", ")", ";", "$iframe", ".", "add", "(", "$div", ")", ".", "css", "(", "{", "opacity", ":", "0", ",", ...
Initialize an iframe to fire events on resize @returns {void} @private
[ "Initialize", "an", "iframe", "to", "fire", "events", "on", "resize" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6121-L6138
25,450
box/viewer.js
dist/crocodoc.viewer.js
checkResize
function checkResize() { var newOffsetHeight = element.offsetHeight, newOffsetWidth = element.offsetWidth; // check if we're in a frame if (inIframe) { // firefox has an issue where styles aren't calculated in hidden iframes // if the iframe was hidden and is...
javascript
function checkResize() { var newOffsetHeight = element.offsetHeight, newOffsetWidth = element.offsetWidth; // check if we're in a frame if (inIframe) { // firefox has an issue where styles aren't calculated in hidden iframes // if the iframe was hidden and is...
[ "function", "checkResize", "(", ")", "{", "var", "newOffsetHeight", "=", "element", ".", "offsetHeight", ",", "newOffsetWidth", "=", "element", ".", "offsetWidth", ";", "// check if we're in a frame", "if", "(", "inIframe", ")", "{", "// firefox has an issue where sty...
Check if the element has resized, and broadcast the resize event if so @returns {void} @private
[ "Check", "if", "the", "element", "has", "resized", "and", "broadcast", "the", "resize", "event", "if", "so" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6145-L6173
25,451
box/viewer.js
dist/crocodoc.viewer.js
function (el) { element = $(el).get(0); // use the documentElement for viewport dimensions // if we are using the window as the viewport if (element === window) { element = document.documentElement; $window.on('resize', checkResize); ...
javascript
function (el) { element = $(el).get(0); // use the documentElement for viewport dimensions // if we are using the window as the viewport if (element === window) { element = document.documentElement; $window.on('resize', checkResize); ...
[ "function", "(", "el", ")", "{", "element", "=", "$", "(", "el", ")", ".", "get", "(", "0", ")", ";", "// use the documentElement for viewport dimensions", "// if we are using the window as the viewport", "if", "(", "element", "===", "window", ")", "{", "element",...
Initialize the Resizer component with an element to watch @param {HTMLElement} el The element to watch @returns {void}
[ "Initialize", "the", "Resizer", "component", "with", "an", "element", "to", "watch" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6199-L6214
25,452
box/viewer.js
dist/crocodoc.viewer.js
handleScroll
function handleScroll() { // if we are just starting scrolling, fire scrollstart event if (!scrollingStarted) { scrollingStarted = true; scope.broadcast('scrollstart', buildEventData()); } clearTimeout(scrollendTID); scrollendTID = setTimeout(handleScrollE...
javascript
function handleScroll() { // if we are just starting scrolling, fire scrollstart event if (!scrollingStarted) { scrollingStarted = true; scope.broadcast('scrollstart', buildEventData()); } clearTimeout(scrollendTID); scrollendTID = setTimeout(handleScrollE...
[ "function", "handleScroll", "(", ")", "{", "// if we are just starting scrolling, fire scrollstart event", "if", "(", "!", "scrollingStarted", ")", "{", "scrollingStarted", "=", "true", ";", "scope", ".", "broadcast", "(", "'scrollstart'", ",", "buildEventData", "(", ...
Handle scroll events @returns {void} @private
[ "Handle", "scroll", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6288-L6297
25,453
box/viewer.js
dist/crocodoc.viewer.js
handleTouchend
function handleTouchend() { touchStarted = false; touchEnded = true; touchEndTime = new Date().getTime(); if (touchMoved) { ghostScroll(); } }
javascript
function handleTouchend() { touchStarted = false; touchEnded = true; touchEndTime = new Date().getTime(); if (touchMoved) { ghostScroll(); } }
[ "function", "handleTouchend", "(", ")", "{", "touchStarted", "=", "false", ";", "touchEnded", "=", "true", ";", "touchEndTime", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "if", "(", "touchMoved", ")", "{", "ghostScroll", "(", ")", ";"...
Handle touchend events @returns {void} @private
[ "Handle", "touchend", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6326-L6333
25,454
box/viewer.js
dist/crocodoc.viewer.js
ghostScroll
function ghostScroll() { clearTimeout(scrollendTID); if (ghostScrollStart === null) { ghostScrollStart = new Date().getTime(); } if (new Date().getTime() - ghostScrollStart > GHOST_SCROLL_TIMEOUT) { handleScrollEnd(); return; } fireScro...
javascript
function ghostScroll() { clearTimeout(scrollendTID); if (ghostScrollStart === null) { ghostScrollStart = new Date().getTime(); } if (new Date().getTime() - ghostScrollStart > GHOST_SCROLL_TIMEOUT) { handleScrollEnd(); return; } fireScro...
[ "function", "ghostScroll", "(", ")", "{", "clearTimeout", "(", "scrollendTID", ")", ";", "if", "(", "ghostScrollStart", "===", "null", ")", "{", "ghostScrollStart", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "}", "if", "(", "new", "Da...
Fire fake scroll events. iOS doesn't fire events during the 'momentum' part of scrolling so this is used to fake these events until the page stops moving. @returns {void} @private
[ "Fire", "fake", "scroll", "events", ".", "iOS", "doesn", "t", "fire", "events", "during", "the", "momentum", "part", "of", "scrolling", "so", "this", "is", "used", "to", "fake", "these", "events", "until", "the", "page", "stops", "moving", "." ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6342-L6353
25,455
box/viewer.js
dist/crocodoc.viewer.js
function (el) { $el = $(el); $el.on('scroll', handleScroll); $el.on('touchstart', handleTouchstart); $el.on('touchmove', handleTouchmove); $el.on('touchend', handleTouchend); }
javascript
function (el) { $el = $(el); $el.on('scroll', handleScroll); $el.on('touchstart', handleTouchstart); $el.on('touchmove', handleTouchmove); $el.on('touchend', handleTouchend); }
[ "function", "(", "el", ")", "{", "$el", "=", "$", "(", "el", ")", ";", "$el", ".", "on", "(", "'scroll'", ",", "handleScroll", ")", ";", "$el", ".", "on", "(", "'touchstart'", ",", "handleTouchstart", ")", ";", "$el", ".", "on", "(", "'touchmove'",...
Initialize the scroller component @param {Element} el The Element @returns {void}
[ "Initialize", "the", "scroller", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6361-L6367
25,456
box/viewer.js
dist/crocodoc.viewer.js
function () { clearTimeout(scrollendTID); $el.off('scroll', handleScroll); $el.off('touchstart', handleTouchstart); $el.off('touchmove', handleTouchmove); $el.off('touchend', handleTouchend); }
javascript
function () { clearTimeout(scrollendTID); $el.off('scroll', handleScroll); $el.off('touchstart', handleTouchstart); $el.off('touchmove', handleTouchmove); $el.off('touchend', handleTouchend); }
[ "function", "(", ")", "{", "clearTimeout", "(", "scrollendTID", ")", ";", "$el", ".", "off", "(", "'scroll'", ",", "handleScroll", ")", ";", "$el", ".", "off", "(", "'touchstart'", ",", "handleTouchstart", ")", ";", "$el", ".", "off", "(", "'touchmove'",...
Destroy the scroller component @returns {void}
[ "Destroy", "the", "scroller", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6373-L6379
25,457
box/viewer.js
dist/crocodoc.viewer.js
initViewerHTML
function initViewerHTML() { // create viewer HTML $el.html(Crocodoc.viewerTemplate); if (config.useWindowAsViewport) { config.$viewport = $(window); $el.addClass(CSS_CLASS_WINDOW_AS_VIEWPORT); } else { config.$viewport = $el.find('.' + CSS_CLASS_VIEWPO...
javascript
function initViewerHTML() { // create viewer HTML $el.html(Crocodoc.viewerTemplate); if (config.useWindowAsViewport) { config.$viewport = $(window); $el.addClass(CSS_CLASS_WINDOW_AS_VIEWPORT); } else { config.$viewport = $el.find('.' + CSS_CLASS_VIEWPO...
[ "function", "initViewerHTML", "(", ")", "{", "// create viewer HTML", "$el", ".", "html", "(", "Crocodoc", ".", "viewerTemplate", ")", ";", "if", "(", "config", ".", "useWindowAsViewport", ")", "{", "config", ".", "$viewport", "=", "$", "(", "window", ")", ...
Create and insert basic viewer DOM structure @returns {void} @private
[ "Create", "and", "insert", "basic", "viewer", "DOM", "structure" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6431-L6441
25,458
box/viewer.js
dist/crocodoc.viewer.js
initPlugins
function initPlugins() { var name, plugin, plugins = config.plugins || {}; for (name in plugins) { plugin = scope.createComponent('plugin-' + name); if (plugin && util.isFn(plugin.init)) { plugin.init(config.plugins[name]); } ...
javascript
function initPlugins() { var name, plugin, plugins = config.plugins || {}; for (name in plugins) { plugin = scope.createComponent('plugin-' + name); if (plugin && util.isFn(plugin.init)) { plugin.init(config.plugins[name]); } ...
[ "function", "initPlugins", "(", ")", "{", "var", "name", ",", "plugin", ",", "plugins", "=", "config", ".", "plugins", "||", "{", "}", ";", "for", "(", "name", "in", "plugins", ")", "{", "plugin", "=", "scope", ".", "createComponent", "(", "'plugin-'",...
Initialize all plugins specified for this viewer instance @returns {void} @private
[ "Initialize", "all", "plugins", "specified", "for", "this", "viewer", "instance" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6448-L6458
25,459
box/viewer.js
dist/crocodoc.viewer.js
completeInit
function completeInit() { setCSSFlags(); // initialize scroller and resizer components scroller = scope.createComponent('scroller'); scroller.init(config.$viewport); resizer = scope.createComponent('resizer'); resizer.init(config.$viewport); var controller; ...
javascript
function completeInit() { setCSSFlags(); // initialize scroller and resizer components scroller = scope.createComponent('scroller'); scroller.init(config.$viewport); resizer = scope.createComponent('resizer'); resizer.init(config.$viewport); var controller; ...
[ "function", "completeInit", "(", ")", "{", "setCSSFlags", "(", ")", ";", "// initialize scroller and resizer components", "scroller", "=", "scope", ".", "createComponent", "(", "'scroller'", ")", ";", "scroller", ".", "init", "(", "config", ".", "$viewport", ")", ...
Complete intialization after document metadata has been loaded; ie., bind events, init lazyloader and layout, broadcast ready message @returns {void} @private
[ "Complete", "intialization", "after", "document", "metadata", "has", "been", "loaded", ";", "ie", ".", "bind", "events", "init", "lazyloader", "and", "layout", "broadcast", "ready", "message" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6466-L6518
25,460
box/viewer.js
dist/crocodoc.viewer.js
handleLinkClick
function handleLinkClick(data) { var event = api.fire('linkclick', data); if (!event.isDefaultPrevented()) { if (data.uri) { window.open(data.uri); } else if (data.destination) { api.scrollTo(data.destination.pagenum); } } }
javascript
function handleLinkClick(data) { var event = api.fire('linkclick', data); if (!event.isDefaultPrevented()) { if (data.uri) { window.open(data.uri); } else if (data.destination) { api.scrollTo(data.destination.pagenum); } } }
[ "function", "handleLinkClick", "(", "data", ")", "{", "var", "event", "=", "api", ".", "fire", "(", "'linkclick'", ",", "data", ")", ";", "if", "(", "!", "event", ".", "isDefaultPrevented", "(", ")", ")", "{", "if", "(", "data", ".", "uri", ")", "{...
Handler for linkclick messages @returns {void} @private
[ "Handler", "for", "linkclick", "messages" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6525-L6534
25,461
box/viewer.js
dist/crocodoc.viewer.js
updateDragger
function updateDragger(isDraggable) { if (isDraggable) { if (!dragger) { $el.addClass(CSS_CLASS_DRAGGABLE); dragger = scope.createComponent('dragger'); dragger.init(config.$viewport); } } else { if (dragger) { ...
javascript
function updateDragger(isDraggable) { if (isDraggable) { if (!dragger) { $el.addClass(CSS_CLASS_DRAGGABLE); dragger = scope.createComponent('dragger'); dragger.init(config.$viewport); } } else { if (dragger) { ...
[ "function", "updateDragger", "(", "isDraggable", ")", "{", "if", "(", "isDraggable", ")", "{", "if", "(", "!", "dragger", ")", "{", "$el", ".", "addClass", "(", "CSS_CLASS_DRAGGABLE", ")", ";", "dragger", "=", "scope", ".", "createComponent", "(", "'dragge...
Enable or disable the dragger given the `isDraggable` flag @param {Boolean} isDraggable Whether or not the layout is draggable @returns {void} @private
[ "Enable", "or", "disable", "the", "dragger", "given", "the", "isDraggable", "flag" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6542-L6556
25,462
box/viewer.js
dist/crocodoc.viewer.js
validateQueryParams
function validateQueryParams() { var queryString; if (config.queryParams) { if (typeof config.queryParams === 'string') { // strip '?' if it's there, because we add it below queryString = config.queryParams.replace(/^\?/, ''); } else { ...
javascript
function validateQueryParams() { var queryString; if (config.queryParams) { if (typeof config.queryParams === 'string') { // strip '?' if it's there, because we add it below queryString = config.queryParams.replace(/^\?/, ''); } else { ...
[ "function", "validateQueryParams", "(", ")", "{", "var", "queryString", ";", "if", "(", "config", ".", "queryParams", ")", "{", "if", "(", "typeof", "config", ".", "queryParams", "===", "'string'", ")", "{", "// strip '?' if it's there, because we add it below", "...
Validates and normalizes queryParams config option @returns {void}
[ "Validates", "and", "normalizes", "queryParams", "config", "option" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6562-L6573
25,463
box/viewer.js
dist/crocodoc.viewer.js
function () { config = scope.getConfig(); api = config.api; // create a unique CSS namespace for this viewer instance config.namespace = CSS_CLASS_VIEWER + '-' + config.id; // Setup container $el = config.$el; // add crocodoc viewer ...
javascript
function () { config = scope.getConfig(); api = config.api; // create a unique CSS namespace for this viewer instance config.namespace = CSS_CLASS_VIEWER + '-' + config.id; // Setup container $el = config.$el; // add crocodoc viewer ...
[ "function", "(", ")", "{", "config", "=", "scope", ".", "getConfig", "(", ")", ";", "api", "=", "config", ".", "api", ";", "// create a unique CSS namespace for this viewer instance", "config", ".", "namespace", "=", "CSS_CLASS_VIEWER", "+", "'-'", "+", "config"...
Initialize the viewer api @returns {void}
[ "Initialize", "the", "viewer", "api" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6655-L6689
25,464
box/viewer.js
dist/crocodoc.viewer.js
function () { // empty container and remove all class names that contain "crocodoc" $el.empty().removeClass(function (i, cls) { var match = cls.match(new RegExp('crocodoc\\S+', 'g')); return match && match.join(' '); }); // remove the styl...
javascript
function () { // empty container and remove all class names that contain "crocodoc" $el.empty().removeClass(function (i, cls) { var match = cls.match(new RegExp('crocodoc\\S+', 'g')); return match && match.join(' '); }); // remove the styl...
[ "function", "(", ")", "{", "// empty container and remove all class names that contain \"crocodoc\"", "$el", ".", "empty", "(", ")", ".", "removeClass", "(", "function", "(", "i", ",", "cls", ")", "{", "var", "match", "=", "cls", ".", "match", "(", "new", "Reg...
Destroy the viewer-base component @returns {void}
[ "Destroy", "the", "viewer", "-", "base", "component" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6695-L6708
25,465
box/viewer.js
dist/crocodoc.viewer.js
function (layoutMode) { // create a layout component with the new layout config var lastPage = config.page, lastZoom = config.zoom || 1, previousLayoutMode = config.layout, newLayout; // if there is already a layout, save some state ...
javascript
function (layoutMode) { // create a layout component with the new layout config var lastPage = config.page, lastZoom = config.zoom || 1, previousLayoutMode = config.layout, newLayout; // if there is already a layout, save some state ...
[ "function", "(", "layoutMode", ")", "{", "// create a layout component with the new layout config", "var", "lastPage", "=", "config", ".", "page", ",", "lastZoom", "=", "config", ".", "zoom", "||", "1", ",", "previousLayoutMode", "=", "config", ".", "layout", ",",...
Set the layout to the given mode, destroying and cleaning up the current layout if there is one @param {string} layoutMode The layout mode @returns {Layout} The layout object
[ "Set", "the", "layout", "to", "the", "given", "mode", "destroying", "and", "cleaning", "up", "the", "current", "layout", "if", "there", "is", "one" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6716-L6764
25,466
box/viewer.js
dist/crocodoc.viewer.js
function () { var $loadStylesheetPromise, $loadMetadataPromise, $pageOneContentPromise, $pageOneTextPromise; if ($assetsPromise) { return; } $loadMetadataPromise = scope.get('metadata'); $loadMe...
javascript
function () { var $loadStylesheetPromise, $loadMetadataPromise, $pageOneContentPromise, $pageOneTextPromise; if ($assetsPromise) { return; } $loadMetadataPromise = scope.get('metadata'); $loadMe...
[ "function", "(", ")", "{", "var", "$loadStylesheetPromise", ",", "$loadMetadataPromise", ",", "$pageOneContentPromise", ",", "$pageOneTextPromise", ";", "if", "(", "$assetsPromise", ")", "{", "return", ";", "}", "$loadMetadataPromise", "=", "scope", ".", "get", "(...
Load the metadata and css for this document @returns {void}
[ "Load", "the", "metadata", "and", "css", "for", "this", "document" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/dist/crocodoc.viewer.js#L6770-L6841
25,467
box/viewer.js
plugins/download/download.js
download
function download(url) { var a = document.createElement('a'); a.href = url; a.setAttribute('download', 'doc'); document.body.appendChild(a); a.click(); document.body.removeChild(a); }
javascript
function download(url) { var a = document.createElement('a'); a.href = url; a.setAttribute('download', 'doc'); document.body.appendChild(a); a.click(); document.body.removeChild(a); }
[ "function", "download", "(", "url", ")", "{", "var", "a", "=", "document", ".", "createElement", "(", "'a'", ")", ";", "a", ".", "href", "=", "url", ";", "a", ".", "setAttribute", "(", "'download'", ",", "'doc'", ")", ";", "document", ".", "body", ...
Initiate a download for the given URL @param {string} url The download URL @returns {void} @private
[ "Initiate", "a", "download", "for", "the", "given", "URL" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/download/download.js#L15-L22
25,468
box/viewer.js
plugins/download/download.js
function (config) { var url = config.url, viewerAPI = scope.getConfig().api; if (url) { viewerAPI.download = function () { download(url); }; } }
javascript
function (config) { var url = config.url, viewerAPI = scope.getConfig().api; if (url) { viewerAPI.download = function () { download(url); }; } }
[ "function", "(", "config", ")", "{", "var", "url", "=", "config", ".", "url", ",", "viewerAPI", "=", "scope", ".", "getConfig", "(", ")", ".", "api", ";", "if", "(", "url", ")", "{", "viewerAPI", ".", "download", "=", "function", "(", ")", "{", "...
Initialize the download plugin @param {Object} config The config object @param {string} config.url The download URL @returns {void}
[ "Initialize", "the", "download", "plugin" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/download/download.js#L31-L40
25,469
box/viewer.js
examples/page-content-flip/page-content.js
function (name, data) { switch (name) { case 'ready': // $pages won't be available until the 'ready' message is broadcas var viewerConfig = scope.getConfig(); $pages = viewerConfig.$pages; $viewport = viewerConfi...
javascript
function (name, data) { switch (name) { case 'ready': // $pages won't be available until the 'ready' message is broadcas var viewerConfig = scope.getConfig(); $pages = viewerConfig.$pages; $viewport = viewerConfi...
[ "function", "(", "name", ",", "data", ")", "{", "switch", "(", "name", ")", "{", "case", "'ready'", ":", "// $pages won't be available until the 'ready' message is broadcas", "var", "viewerConfig", "=", "scope", ".", "getConfig", "(", ")", ";", "$pages", "=", "v...
insert content into each page as it loads
[ "insert", "content", "into", "each", "page", "as", "it", "loads" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/examples/page-content-flip/page-content.js#L65-L80
25,470
box/viewer.js
examples/realtime/server.js
sendEvent
function sendEvent() { var data = {}, eventName; if (++i < c) { if (channel.page < channel.numPages) { data.pages = [channel.page++]; eventName = 'pageavailable.svg'; } else { eventName = 'finished.svg'; ...
javascript
function sendEvent() { var data = {}, eventName; if (++i < c) { if (channel.page < channel.numPages) { data.pages = [channel.page++]; eventName = 'pageavailable.svg'; } else { eventName = 'finished.svg'; ...
[ "function", "sendEvent", "(", ")", "{", "var", "data", "=", "{", "}", ",", "eventName", ";", "if", "(", "++", "i", "<", "c", ")", "{", "if", "(", "channel", ".", "page", "<", "channel", ".", "numPages", ")", "{", "data", ".", "pages", "=", "[",...
send 100 events before forcing a reconnect
[ "send", "100", "events", "before", "forcing", "a", "reconnect" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/examples/realtime/server.js#L88-L106
25,471
box/viewer.js
plugins/realtime/realtime.js
updateAvailablePages
function updateAvailablePages(pages) { var i, page; for (i = 0; i < pages.length; ++i) { page = pages[i]; viewerAPI.fire('realtimeupdate', { page: page }); scope.broadcast('pageavailable', { page: page }); } }
javascript
function updateAvailablePages(pages) { var i, page; for (i = 0; i < pages.length; ++i) { page = pages[i]; viewerAPI.fire('realtimeupdate', { page: page }); scope.broadcast('pageavailable', { page: page }); } }
[ "function", "updateAvailablePages", "(", "pages", ")", "{", "var", "i", ",", "page", ";", "for", "(", "i", "=", "0", ";", "i", "<", "pages", ".", "length", ";", "++", "i", ")", "{", "page", "=", "pages", "[", "i", "]", ";", "viewerAPI", ".", "f...
Notify the viewer that new pages are available for loading @param {Array} pages Array of integer page numbers that are available @returns {void} @private
[ "Notify", "the", "viewer", "that", "new", "pages", "are", "available", "for", "loading" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/realtime/realtime.js#L87-L94
25,472
box/viewer.js
plugins/realtime/realtime.js
handleFailedEvent
function handleFailedEvent(event) { var data = getData(event); viewerAPI.fire('realtimeerror', { error: data }); realtime.destroy(); }
javascript
function handleFailedEvent(event) { var data = getData(event); viewerAPI.fire('realtimeerror', { error: data }); realtime.destroy(); }
[ "function", "handleFailedEvent", "(", "event", ")", "{", "var", "data", "=", "getData", "(", "event", ")", ";", "viewerAPI", ".", "fire", "(", "'realtimeerror'", ",", "{", "error", ":", "data", "}", ")", ";", "realtime", ".", "destroy", "(", ")", ";", ...
Handle error and failed eventSource events @param {Event} event The event object @returns {void} @private
[ "Handle", "error", "and", "failed", "eventSource", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/realtime/realtime.js#L113-L117
25,473
box/viewer.js
plugins/realtime/realtime.js
handleErrorEvent
function handleErrorEvent(event) { var data = getData(event); if (data) { viewerAPI.fire('realtimeerror', { error: data.message }); if (data.close) { realtime.destroy(); } } }
javascript
function handleErrorEvent(event) { var data = getData(event); if (data) { viewerAPI.fire('realtimeerror', { error: data.message }); if (data.close) { realtime.destroy(); } } }
[ "function", "handleErrorEvent", "(", "event", ")", "{", "var", "data", "=", "getData", "(", "event", ")", ";", "if", "(", "data", ")", "{", "viewerAPI", ".", "fire", "(", "'realtimeerror'", ",", "{", "error", ":", "data", ".", "message", "}", ")", ";...
Handle eventSource errors @param {Event} event The event object @returns {void} @private
[ "Handle", "eventSource", "errors" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/realtime/realtime.js#L139-L147
25,474
box/viewer.js
plugins/realtime/realtime.js
registerBoxViewPageEventHandlers
function registerBoxViewPageEventHandlers() { // event names depend on whether we support svg or not if (scope.getUtility('support').svg) { realtime.on('pageavailable.svg', handlePageAvailableEvent); realtime.on('finished.svg', handleFinishedEvent); realtime.on('faile...
javascript
function registerBoxViewPageEventHandlers() { // event names depend on whether we support svg or not if (scope.getUtility('support').svg) { realtime.on('pageavailable.svg', handlePageAvailableEvent); realtime.on('finished.svg', handleFinishedEvent); realtime.on('faile...
[ "function", "registerBoxViewPageEventHandlers", "(", ")", "{", "// event names depend on whether we support svg or not", "if", "(", "scope", ".", "getUtility", "(", "'support'", ")", ".", "svg", ")", "{", "realtime", ".", "on", "(", "'pageavailable.svg'", ",", "handle...
Registers event handlers for page streaming specific realtime events @returns {void} @private
[ "Registers", "event", "handlers", "for", "page", "streaming", "specific", "realtime", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/realtime/realtime.js#L154-L167
25,475
box/viewer.js
plugins/realtime/realtime.js
function (config, EventSource) { var url = config.url; if (url) { realtime = new Crocodoc.Realtime(url, EventSource || window.EventSource); // force the viewer to think conversion is not complete // @TODO: ideally this wouldn't have to make an ext...
javascript
function (config, EventSource) { var url = config.url; if (url) { realtime = new Crocodoc.Realtime(url, EventSource || window.EventSource); // force the viewer to think conversion is not complete // @TODO: ideally this wouldn't have to make an ext...
[ "function", "(", "config", ",", "EventSource", ")", "{", "var", "url", "=", "config", ".", "url", ";", "if", "(", "url", ")", "{", "realtime", "=", "new", "Crocodoc", ".", "Realtime", "(", "url", ",", "EventSource", "||", "window", ".", "EventSource", ...
Initialize the realtime plugin @param {Object} config The config object @param {string} config.url The URL to connect to for realtime events @param {Function} [EventSource] EventSource constructor to use (for testing purposes) @returns {void}
[ "Initialize", "the", "realtime", "plugin" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/realtime/realtime.js#L177-L190
25,476
box/viewer.js
plugins/fullscreen/fullscreen.js
isFullscreen
function isFullscreen() { return document.fullScreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || isFakeFullscreen; }
javascript
function isFullscreen() { return document.fullScreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || isFakeFullscreen; }
[ "function", "isFullscreen", "(", ")", "{", "return", "document", ".", "fullScreenElement", "||", "document", ".", "webkitFullscreenElement", "||", "document", ".", "mozFullScreenElement", "||", "document", ".", "msFullscreenElement", "||", "isFakeFullscreen", ";", "}"...
Return true if full screen is active @returns {boolean} @private
[ "Return", "true", "if", "full", "screen", "is", "active" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/fullscreen/fullscreen.js#L30-L36
25,477
box/viewer.js
plugins/fullscreen/fullscreen.js
fullscreenchangeHandler
function fullscreenchangeHandler() { viewerAPI.fire('fullscreenchange'); if (isFullscreen()) { $el.addClass('crocodoc-fullscreen'); viewerAPI.fire('fullscreenenter'); } else { $el.removeClass('crocodoc-fullscreen'); viewerAPI.fire('fullscreenexit')...
javascript
function fullscreenchangeHandler() { viewerAPI.fire('fullscreenchange'); if (isFullscreen()) { $el.addClass('crocodoc-fullscreen'); viewerAPI.fire('fullscreenenter'); } else { $el.removeClass('crocodoc-fullscreen'); viewerAPI.fire('fullscreenexit')...
[ "function", "fullscreenchangeHandler", "(", ")", "{", "viewerAPI", ".", "fire", "(", "'fullscreenchange'", ")", ";", "if", "(", "isFullscreen", "(", ")", ")", "{", "$el", ".", "addClass", "(", "'crocodoc-fullscreen'", ")", ";", "viewerAPI", ".", "fire", "(",...
Handle fullscreenchange events @returns {void} @private
[ "Handle", "fullscreenchange", "events" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/fullscreen/fullscreen.js#L43-L52
25,478
box/viewer.js
plugins/fullscreen/fullscreen.js
function (config) { config = config || {}; if (typeof config.useFakeFullscreen !== 'undefined') { useFakeFullscreen = config.useFakeFullscreen; } if (viewerConfig.useWindowAsViewport) { // fake fullscreen mode is redundant if the window is...
javascript
function (config) { config = config || {}; if (typeof config.useFakeFullscreen !== 'undefined') { useFakeFullscreen = config.useFakeFullscreen; } if (viewerConfig.useWindowAsViewport) { // fake fullscreen mode is redundant if the window is...
[ "function", "(", "config", ")", "{", "config", "=", "config", "||", "{", "}", ";", "if", "(", "typeof", "config", ".", "useFakeFullscreen", "!==", "'undefined'", ")", "{", "useFakeFullscreen", "=", "config", ".", "useFakeFullscreen", ";", "}", "if", "(", ...
Initialize the fullscreen plugin @param {Object} config Config options for the fullscreen plugin @param {Element} config.element The element to use for fullscreen @param {boolen} config.useFakeFullscreen Whether to use fake fullscreen mode @returns {void}
[ "Initialize", "the", "fullscreen", "plugin" ]
7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17
https://github.com/box/viewer.js/blob/7d11f2e4b01ef418aeb76efe2c2e5f08950f7c17/plugins/fullscreen/fullscreen.js#L132-L178
25,479
stormpath/express-stormpath
lib/oauth/common.js
function (req, res) { var oauthQueryStateToken = req.query.state; var oauthCookieStateToken = req.cookies.oauthStateToken; if (!oauthQueryStateToken || (!oauthCookieStateToken)) { return false; } else if (oauthQueryStateToken !== oauthCookieStateToken) { return false; } res.clearCo...
javascript
function (req, res) { var oauthQueryStateToken = req.query.state; var oauthCookieStateToken = req.cookies.oauthStateToken; if (!oauthQueryStateToken || (!oauthCookieStateToken)) { return false; } else if (oauthQueryStateToken !== oauthCookieStateToken) { return false; } res.clearCo...
[ "function", "(", "req", ",", "res", ")", "{", "var", "oauthQueryStateToken", "=", "req", ".", "query", ".", "state", ";", "var", "oauthCookieStateToken", "=", "req", ".", "cookies", ".", "oauthStateToken", ";", "if", "(", "!", "oauthQueryStateToken", "||", ...
Consume a state token cookie. @method @private @param {Object} req - The http request. @param {Object} res - The http response. @return {bool} Whether or not the token was successfully verified and consumed.
[ "Consume", "a", "state", "token", "cookie", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/common.js#L21-L34
25,480
stormpath/express-stormpath
lib/oauth/common.js
function (req, res) { var oauthStateToken = req.cookies.oauthStateToken; if (!oauthStateToken) { oauthStateToken = uuid.v4(); setTempCookie(res, 'oauthStateToken', oauthStateToken); } return oauthStateToken; }
javascript
function (req, res) { var oauthStateToken = req.cookies.oauthStateToken; if (!oauthStateToken) { oauthStateToken = uuid.v4(); setTempCookie(res, 'oauthStateToken', oauthStateToken); } return oauthStateToken; }
[ "function", "(", "req", ",", "res", ")", "{", "var", "oauthStateToken", "=", "req", ".", "cookies", ".", "oauthStateToken", ";", "if", "(", "!", "oauthStateToken", ")", "{", "oauthStateToken", "=", "uuid", ".", "v4", "(", ")", ";", "setTempCookie", "(", ...
Resolve a state token from a request. If then token doesn't exist then a new token is created and appended onto the response. @method @private @param {Object} req - The http request. @param {Object} res - The http response. @return {string} A state token (UUID).
[ "Resolve", "a", "state", "token", "from", "a", "request", ".", "If", "then", "token", "doesn", "t", "exist", "then", "a", "new", "token", "is", "created", "and", "appended", "onto", "the", "response", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/common.js#L47-L56
25,481
stormpath/express-stormpath
lib/oauth/common.js
function (req, res) { var redirectTo = req.cookies.oauthRedirectUri || false; if (redirectTo) { res.clearCookie('oauthRedirectUri'); } return redirectTo; }
javascript
function (req, res) { var redirectTo = req.cookies.oauthRedirectUri || false; if (redirectTo) { res.clearCookie('oauthRedirectUri'); } return redirectTo; }
[ "function", "(", "req", ",", "res", ")", "{", "var", "redirectTo", "=", "req", ".", "cookies", ".", "oauthRedirectUri", "||", "false", ";", "if", "(", "redirectTo", ")", "{", "res", ".", "clearCookie", "(", "'oauthRedirectUri'", ")", ";", "}", "return", ...
Consume a redirect uri cookie. @method @private @param {Object} req - The http request. @param {Object} res - The http response. @return {mixed} The redirect uri (string) or false if didn't exist.
[ "Consume", "a", "redirect", "uri", "cookie", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/common.js#L68-L76
25,482
stormpath/express-stormpath
lib/oauth/common.js
function (req, provider, callback) { var config = req.app.get('stormpathConfig'); var baseUrl = config.web.baseUrl || req.protocol + '://' + getHost(req); var code = req.query.code; var oauthStateToken = req.cookies.oauthStateToken; var options = { form: { grant_type: 'authorization_co...
javascript
function (req, provider, callback) { var config = req.app.get('stormpathConfig'); var baseUrl = config.web.baseUrl || req.protocol + '://' + getHost(req); var code = req.query.code; var oauthStateToken = req.cookies.oauthStateToken; var options = { form: { grant_type: 'authorization_co...
[ "function", "(", "req", ",", "provider", ",", "callback", ")", "{", "var", "config", "=", "req", ".", "app", ".", "get", "(", "'stormpathConfig'", ")", ";", "var", "baseUrl", "=", "config", ".", "web", ".", "baseUrl", "||", "req", ".", "protocol", "+...
Exchange an authentication code for an OAuth access token. @method @private @param {string} config - stormpathConfig object @param {string} code - The authentication code. @param {string} baseUrl - The base url to prepend to the callback uri. @param {Object} provider - The provider object that contains the client id,...
[ "Exchange", "an", "authentication", "code", "for", "an", "OAuth", "access", "token", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/common.js#L90-L140
25,483
stormpath/express-stormpath
lib/middleware/default-organization-resolver.js
continueWithSubDomainStrategy
function continueWithSubDomainStrategy() { if (web.multiTenancy.strategy === 'subdomain') { if ((web.domainName === currentHost.domain) && currentHost.subdomain) { return resolveOrganizationByNameKey(currentHost.subdomain, function (err, organization) { if (err) { return next(...
javascript
function continueWithSubDomainStrategy() { if (web.multiTenancy.strategy === 'subdomain') { if ((web.domainName === currentHost.domain) && currentHost.subdomain) { return resolveOrganizationByNameKey(currentHost.subdomain, function (err, organization) { if (err) { return next(...
[ "function", "continueWithSubDomainStrategy", "(", ")", "{", "if", "(", "web", ".", "multiTenancy", ".", "strategy", "===", "'subdomain'", ")", "{", "if", "(", "(", "web", ".", "domainName", "===", "currentHost", ".", "domain", ")", "&&", "currentHost", ".", ...
Strategy which tries to resolve an organization from a sub domain. If this step fails then it falls back to resolving an organization from an access token cookie.
[ "Strategy", "which", "tries", "to", "resolve", "an", "organization", "from", "a", "sub", "domain", ".", "If", "this", "step", "fails", "then", "it", "falls", "back", "to", "resolving", "an", "organization", "from", "an", "access", "token", "cookie", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/middleware/default-organization-resolver.js#L55-L89
25,484
stormpath/express-stormpath
lib/helpers/revoke-token.js
revokeToken
function revokeToken(config, token, tokenType, callback) { callback = callback || function () {}; var req = { url: config.org + 'oauth2/' + config.authorizationServerId + '/v1/revoke', method: 'POST', form: { token: tokenType, token_type_hint: tokenType, client_id: config.authorizatio...
javascript
function revokeToken(config, token, tokenType, callback) { callback = callback || function () {}; var req = { url: config.org + 'oauth2/' + config.authorizationServerId + '/v1/revoke', method: 'POST', form: { token: tokenType, token_type_hint: tokenType, client_id: config.authorizatio...
[ "function", "revokeToken", "(", "config", ",", "token", ",", "tokenType", ",", "callback", ")", "{", "callback", "=", "callback", "||", "function", "(", ")", "{", "}", ";", "var", "req", "=", "{", "url", ":", "config", ".", "org", "+", "'oauth2/'", "...
Revoke a token. @method @private @param {tokenResolverFn} tokenResolver - Function that resolves a token of some kind. @param {string} jwt - Raw JWT. @param {string} jwtSigningKey - Secret used to sign the JWT. @param {callbackFn} callback - Optional callback.
[ "Revoke", "a", "token", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/helpers/revoke-token.js#L16-L31
25,485
stormpath/express-stormpath
lib/controllers/change-password.js
resetPasswordWithRecoveryToken
function resetPasswordWithRecoveryToken(client, recoveryTokenResource, newPassword, callback) { var userHref = '/users/' + recoveryTokenResource._embedded.user.id; client.getAccount(userHref, function (err, account) { if (err) { return callback(err); } var href = '/authn/recovery/answer'; ...
javascript
function resetPasswordWithRecoveryToken(client, recoveryTokenResource, newPassword, callback) { var userHref = '/users/' + recoveryTokenResource._embedded.user.id; client.getAccount(userHref, function (err, account) { if (err) { return callback(err); } var href = '/authn/recovery/answer'; ...
[ "function", "resetPasswordWithRecoveryToken", "(", "client", ",", "recoveryTokenResource", ",", "newPassword", ",", "callback", ")", "{", "var", "userHref", "=", "'/users/'", "+", "recoveryTokenResource", ".", "_embedded", ".", "user", ".", "id", ";", "client", "....
Uses the AuthN API to complete a password reset workflow. Use application.sendPasswordResetEmail() to get recoveryTokenResponse @param {*} client stormpath client instance @param {*} recoveryTokenResource the response from /authn/recovery/password @param {*} newPassword new password that the end-user has provided @pa...
[ "Uses", "the", "AuthN", "API", "to", "complete", "a", "password", "reset", "workflow", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/change-password.js#L17-L49
25,486
stormpath/express-stormpath
lib/controllers/change-password.js
function (form) { var viewData = { form: form, organization: req.organization }; if (form.data.password !== form.data.passwordAgain) { viewData.error = 'Passwords do not match.'; return helpers.render(req, res, vi...
javascript
function (form) { var viewData = { form: form, organization: req.organization }; if (form.data.password !== form.data.passwordAgain) { viewData.error = 'Passwords do not match.'; return helpers.render(req, res, vi...
[ "function", "(", "form", ")", "{", "var", "viewData", "=", "{", "form", ":", "form", ",", "organization", ":", "req", ".", "organization", "}", ";", "if", "(", "form", ".", "data", ".", "password", "!==", "form", ".", "data", ".", "passwordAgain", ")...
If we get here, it means the user is submitting a password change request, so we should attempt to change the user's password.
[ "If", "we", "get", "here", "it", "means", "the", "user", "is", "submitting", "a", "password", "change", "request", "so", "we", "should", "attempt", "to", "change", "the", "user", "s", "password", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/change-password.js#L126-L169
25,487
stormpath/express-stormpath
lib/controllers/change-password.js
function (form) { helpers.render(req, res, view, { form: form, organization: req.organization }); }
javascript
function (form) { helpers.render(req, res, view, { form: form, organization: req.organization }); }
[ "function", "(", "form", ")", "{", "helpers", ".", "render", "(", "req", ",", "res", ",", "view", ",", "{", "form", ":", "form", ",", "organization", ":", "req", ".", "organization", "}", ")", ";", "}" ]
If we get here, it means the user is doing a simple GET request, so we should just render the forgot password template.
[ "If", "we", "get", "here", "it", "means", "the", "user", "is", "doing", "a", "simple", "GET", "request", "so", "we", "should", "just", "render", "the", "forgot", "password", "template", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/change-password.js#L183-L185
25,488
stormpath/express-stormpath
lib/stormpath.js
initClient
function initClient(app, opts) { opts.userAgent = userAgent; var logger = opts.logger; if (!logger) { logger = new winston.Logger({ transports: [ new winston.transports.Console({ colorize: true, level: opts.debug || 'error' }) ] }); } app.set('stormpa...
javascript
function initClient(app, opts) { opts.userAgent = userAgent; var logger = opts.logger; if (!logger) { logger = new winston.Logger({ transports: [ new winston.transports.Console({ colorize: true, level: opts.debug || 'error' }) ] }); } app.set('stormpa...
[ "function", "initClient", "(", "app", ",", "opts", ")", "{", "opts", ".", "userAgent", "=", "userAgent", ";", "var", "logger", "=", "opts", ".", "logger", ";", "if", "(", "!", "logger", ")", "{", "logger", "=", "new", "winston", ".", "Logger", "(", ...
Initialize the Stormpath client. @method @private @param {Object} app - The express application. @param {object} opts - A JSON hash of user supplied options. @return {Function} A function which accepts a callback.
[ "Initialize", "the", "Stormpath", "client", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/stormpath.js#L28-L59
25,489
stormpath/express-stormpath
lib/helpers/organization-resolution-guard.js
function (form) { render(req, res, 'organization-select', { form: form, formActionUri: formActionUri, formModel: organizationSelectFormModel }); }
javascript
function (form) { render(req, res, 'organization-select', { form: form, formActionUri: formActionUri, formModel: organizationSelectFormModel }); }
[ "function", "(", "form", ")", "{", "render", "(", "req", ",", "res", ",", "'organization-select'", ",", "{", "form", ":", "form", ",", "formActionUri", ":", "formActionUri", ",", "formModel", ":", "organizationSelectFormModel", "}", ")", ";", "}" ]
If we get here, it means the user is doing a simple GET request, so we should just render the original template.
[ "If", "we", "get", "here", "it", "means", "the", "user", "is", "doing", "a", "simple", "GET", "request", "so", "we", "should", "just", "render", "the", "original", "template", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/helpers/organization-resolution-guard.js#L121-L127
25,490
stormpath/express-stormpath
lib/oauth/error-responder.js
renderLoginFormWithError
function renderLoginFormWithError(req, res, config, err) { var logger = req.app.get('stormpathLogger'); var view = config.web.login.view; var nextUri = url.parse(req.query.next || '').path; var encodedNextUri = encodeURIComponent(nextUri); var formActionUri = config.web.login.uri + (nextUri ? ('?next=' + enco...
javascript
function renderLoginFormWithError(req, res, config, err) { var logger = req.app.get('stormpathLogger'); var view = config.web.login.view; var nextUri = url.parse(req.query.next || '').path; var encodedNextUri = encodeURIComponent(nextUri); var formActionUri = config.web.login.uri + (nextUri ? ('?next=' + enco...
[ "function", "renderLoginFormWithError", "(", "req", ",", "res", ",", "config", ",", "err", ")", "{", "var", "logger", "=", "req", ".", "app", ".", "get", "(", "'stormpathLogger'", ")", ";", "var", "view", "=", "config", ".", "web", ".", "login", ".", ...
Takes an error object and renders the login form with that error. @method @param {Object} req - The http request. @param {Object} res - The http response. @param {Object} config - Stormpath config. @param {Object} err - The error to display.
[ "Takes", "an", "error", "object", "and", "renders", "the", "login", "form", "with", "that", "error", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/error-responder.js#L23-L58
25,491
stormpath/express-stormpath
lib/oauth/error-responder.js
oauthErrorResponder
function oauthErrorResponder(req, res, err) { var accepts = req.accepts(['html', 'json']); var config = req.app.get('stormpathConfig'); if (accepts === 'json') { return writeJsonError(res, err); } return renderLoginFormWithError(req, res, config, err); }
javascript
function oauthErrorResponder(req, res, err) { var accepts = req.accepts(['html', 'json']); var config = req.app.get('stormpathConfig'); if (accepts === 'json') { return writeJsonError(res, err); } return renderLoginFormWithError(req, res, config, err); }
[ "function", "oauthErrorResponder", "(", "req", ",", "res", ",", "err", ")", "{", "var", "accepts", "=", "req", ".", "accepts", "(", "[", "'html'", ",", "'json'", "]", ")", ";", "var", "config", "=", "req", ".", "app", ".", "get", "(", "'stormpathConf...
Takes an error object and responds either by rendering the login form with the error, or by returning the error as JSON. @method @param {Object} req - The http request. @param {Object} res - The http response. @param {Object} err - The error to handle.
[ "Takes", "an", "error", "object", "and", "responds", "either", "by", "rendering", "the", "login", "form", "with", "the", "error", "or", "by", "returning", "the", "error", "as", "JSON", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/error-responder.js#L71-L80
25,492
stormpath/express-stormpath
lib/controllers/register.js
defaultUnverifiedHtmlResponse
function defaultUnverifiedHtmlResponse(req, res) { var config = req.app.get('stormpathConfig'); res.redirect(302, config.web.login.uri + '?status=unverified'); }
javascript
function defaultUnverifiedHtmlResponse(req, res) { var config = req.app.get('stormpathConfig'); res.redirect(302, config.web.login.uri + '?status=unverified'); }
[ "function", "defaultUnverifiedHtmlResponse", "(", "req", ",", "res", ")", "{", "var", "config", "=", "req", ".", "app", ".", "get", "(", "'stormpathConfig'", ")", ";", "res", ".", "redirect", "(", "302", ",", "config", ".", "web", ".", "login", ".", "u...
Delivers the default response for registration attempts that accept an HTML content type, where the new account is in an unverified state. In this situation we redirect to the login page with a query parameter that indidcates that the account is unverified @function @param {Object} req - The http request. @param {Obj...
[ "Delivers", "the", "default", "response", "for", "registration", "attempts", "that", "accept", "an", "HTML", "content", "type", "where", "the", "new", "account", "is", "in", "an", "unverified", "state", ".", "In", "this", "situation", "we", "redirect", "to", ...
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/register.js#L22-L25
25,493
stormpath/express-stormpath
lib/controllers/register.js
defaultAutoAuthorizeHtmlResponse
function defaultAutoAuthorizeHtmlResponse(req, res) { var config = req.app.get('stormpathConfig'); res.redirect(302, url.parse(req.query.next || '').path || config.web.register.nextUri); }
javascript
function defaultAutoAuthorizeHtmlResponse(req, res) { var config = req.app.get('stormpathConfig'); res.redirect(302, url.parse(req.query.next || '').path || config.web.register.nextUri); }
[ "function", "defaultAutoAuthorizeHtmlResponse", "(", "req", ",", "res", ")", "{", "var", "config", "=", "req", ".", "app", ".", "get", "(", "'stormpathConfig'", ")", ";", "res", ".", "redirect", "(", "302", ",", "url", ".", "parse", "(", "req", ".", "q...
Delivers the default response for registration attempts that accept an HTML content type, where the new account is in a verified state and the config has requested that we automatically log in the user. In this situation we redirect to the next URI that is in the url, or the nextUri that is defined on the registration ...
[ "Delivers", "the", "default", "response", "for", "registration", "attempts", "that", "accept", "an", "HTML", "content", "type", "where", "the", "new", "account", "is", "in", "a", "verified", "state", "and", "the", "config", "has", "requested", "that", "we", ...
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/register.js#L56-L59
25,494
stormpath/express-stormpath
lib/controllers/register.js
defaultJsonResponse
function defaultJsonResponse(req, res) { res.json({ account: helpers.strippedAccount(req.user) }); }
javascript
function defaultJsonResponse(req, res) { res.json({ account: helpers.strippedAccount(req.user) }); }
[ "function", "defaultJsonResponse", "(", "req", ",", "res", ")", "{", "res", ".", "json", "(", "{", "account", ":", "helpers", ".", "strippedAccount", "(", "req", ".", "user", ")", "}", ")", ";", "}" ]
Delivers the default response for registration attempts that accept a JSON content type. In this situation we simply return the new account object as JSON @function @param {Object} req - The http request. @param {Object} res - The http response.
[ "Delivers", "the", "default", "response", "for", "registration", "attempts", "that", "accept", "a", "JSON", "content", "type", ".", "In", "this", "situation", "we", "simply", "return", "the", "new", "account", "object", "as", "JSON" ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/register.js#L71-L75
25,495
stormpath/express-stormpath
lib/controllers/register.js
applyDefaultAccountFields
function applyDefaultAccountFields(stormpathConfig, req) { var registerFields = stormpathConfig.web.register.form.fields; if ((!registerFields.givenName || !registerFields.givenName.required || !registerFields.givenName.enabled) && !req.body.givenName) { req.body.givenName = 'UNKNOWN'; } if ((!registerFie...
javascript
function applyDefaultAccountFields(stormpathConfig, req) { var registerFields = stormpathConfig.web.register.form.fields; if ((!registerFields.givenName || !registerFields.givenName.required || !registerFields.givenName.enabled) && !req.body.givenName) { req.body.givenName = 'UNKNOWN'; } if ((!registerFie...
[ "function", "applyDefaultAccountFields", "(", "stormpathConfig", ",", "req", ")", "{", "var", "registerFields", "=", "stormpathConfig", ".", "web", ".", "register", ".", "form", ".", "fields", ";", "if", "(", "(", "!", "registerFields", ".", "givenName", "||",...
The Stormpath API requires the `givenName` and `surname` fields to be provided, but as a convenience our framework integrations allow you to omit this data and fill those fields with the string `UNKNOWN` - but only if the field is not explicitly required. @function @param {Object} stormpathConfig - The express-stormp...
[ "The", "Stormpath", "API", "requires", "the", "givenName", "and", "surname", "fields", "to", "be", "provided", "but", "as", "a", "convenience", "our", "framework", "integrations", "allow", "you", "to", "omit", "this", "data", "and", "fill", "those", "fields", ...
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/register.js#L88-L98
25,496
stormpath/express-stormpath
lib/oauth/linkedin.js
function (req, config, callback) { var baseUrl = config.web.baseUrl || req.protocol + '://' + getHost(req); var linkedInAuthUrl = 'https://www.linkedin.com/uas/oauth2/accessToken'; var linkedInProvider = config.web.social.linkedin; var options = { form: { grant_type: 'authorization_code',...
javascript
function (req, config, callback) { var baseUrl = config.web.baseUrl || req.protocol + '://' + getHost(req); var linkedInAuthUrl = 'https://www.linkedin.com/uas/oauth2/accessToken'; var linkedInProvider = config.web.social.linkedin; var options = { form: { grant_type: 'authorization_code',...
[ "function", "(", "req", ",", "config", ",", "callback", ")", "{", "var", "baseUrl", "=", "config", ".", "web", ".", "baseUrl", "||", "req", ".", "protocol", "+", "'://'", "+", "getHost", "(", "req", ")", ";", "var", "linkedInAuthUrl", "=", "'https://ww...
Exchange a LinkedIn authentication code for a OAuth access token. @method @private @param {Object} req - The http request. @param {string} config - The Stormpath express config object. @param {string} callback - The callback to call once a response has been resolved.
[ "Exchange", "a", "LinkedIn", "authentication", "code", "for", "a", "OAuth", "access", "token", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/oauth/linkedin.js#L18-L59
25,497
stormpath/express-stormpath
lib/okta/error-transformer.js
oktaErrorTransformer
function oktaErrorTransformer(err) { if (err && err.errorCauses) { err.errorCauses.forEach(function (cause) { if (cause.errorSummary === 'login: An object with this field already exists in the current organization') { err.userMessage = 'An account with that email address already exists.'; } el...
javascript
function oktaErrorTransformer(err) { if (err && err.errorCauses) { err.errorCauses.forEach(function (cause) { if (cause.errorSummary === 'login: An object with this field already exists in the current organization') { err.userMessage = 'An account with that email address already exists.'; } el...
[ "function", "oktaErrorTransformer", "(", "err", ")", "{", "if", "(", "err", "&&", "err", ".", "errorCauses", ")", "{", "err", ".", "errorCauses", ".", "forEach", "(", "function", "(", "cause", ")", "{", "if", "(", "cause", ".", "errorSummary", "===", "...
Translates user creation errors into an end-user friendly userMessage @param {*} err
[ "Translates", "user", "creation", "errors", "into", "an", "end", "-", "user", "friendly", "userMessage" ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/okta/error-transformer.js#L7-L31
25,498
stormpath/express-stormpath
lib/controllers/forgot-password.js
function (form) { var data = { email: form.data.email }; if (req.organization) { data.accountStore = { href: req.organization.href }; } application.sendPasswordResetEmail(data, function (err) { ...
javascript
function (form) { var data = { email: form.data.email }; if (req.organization) { data.accountStore = { href: req.organization.href }; } application.sendPasswordResetEmail(data, function (err) { ...
[ "function", "(", "form", ")", "{", "var", "data", "=", "{", "email", ":", "form", ".", "data", ".", "email", "}", ";", "if", "(", "req", ".", "organization", ")", "{", "data", ".", "accountStore", "=", "{", "href", ":", "req", ".", "organization", ...
If we get here, it means the user is submitting a password reset request, so we should attempt to send the user a password reset email.
[ "If", "we", "get", "here", "it", "means", "the", "user", "is", "submitting", "a", "password", "reset", "request", "so", "we", "should", "attempt", "to", "send", "the", "user", "a", "password", "reset", "email", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/forgot-password.js#L55-L73
25,499
stormpath/express-stormpath
lib/controllers/login.js
function (form) { if (config.web.multiTenancy.enabled && req.organization) { setAccountStoreByHref(form.data, req.organization); } else { /** * Delete this form field, it's automatically added by the * forms library. If we do...
javascript
function (form) { if (config.web.multiTenancy.enabled && req.organization) { setAccountStoreByHref(form.data, req.organization); } else { /** * Delete this form field, it's automatically added by the * forms library. If we do...
[ "function", "(", "form", ")", "{", "if", "(", "config", ".", "web", ".", "multiTenancy", ".", "enabled", "&&", "req", ".", "organization", ")", "{", "setAccountStoreByHref", "(", "form", ".", "data", ",", "req", ".", "organization", ")", ";", "}", "els...
If we get here, it means the user is submitting a login request, so we should attempt to log the user into their account.
[ "If", "we", "get", "here", "it", "means", "the", "user", "is", "submitting", "a", "login", "request", "so", "we", "should", "attempt", "to", "log", "the", "user", "into", "their", "account", "." ]
aed8d26ba51272755ea4eab706b4417e4bbeed99
https://github.com/stormpath/express-stormpath/blob/aed8d26ba51272755ea4eab706b4417e4bbeed99/lib/controllers/login.js#L122-L147