‘;
return;
case (_contentsLength == 0):
case ((_contentsLength -1)):
$R.debugOutline(_node, ‘clean-after’, ‘blank’);
_global__the_html = _global__the_html.substr(0, _pos__start__before);
return;
}
break;
}
// too much missing
// ================
if ($R.parsingOptions._elements_link_density.indexOf(‘|’+_tag_name+’|’) > -1)
{
_explored = (_explored || $R.getContent__exploreNodeAndGetStuff(_node, true));
var
_contents = _global__the_html
.substr(_pos__start__after, (_pos__end__before – _pos__start__after))
.replace(/(]+)>)/gi, ”),
_contentsLength = $R.measureText__getTextLength(_contents),
_initialLength = 0
+ _explored._length__all_text
+ (_explored._count__images_small * 10)
+ (_explored._count__images_skip * 10)
+ (_node.getElementsByTagName(‘iframe’).length * 10)
+ (_node.getElementsByTagName(‘object’).length * 10)
+ (_node.getElementsByTagName(‘embed’).length * 10)
+ (_node.getElementsByTagName(‘button’).length * 10)
+ (_node.getElementsByTagName(‘input’).length * 10)
+ (_node.getElementsByTagName(‘select’).length * 10)
+ (_node.getElementsByTagName(‘textarea’).length * 10)
;
// too much missing
switch (true)
{
case (!(_contentsLength > 0)):
case (!(_initialLength > 0)):
case (!((_contentsLength / _initialLength) < 0.5)):
case (!(($R.language == 'cjk') && (_contentsLength / _initialLength) 0.25))):
case (($R.language == ‘cjk’) && (_global__exploreNodeToBuildHTMLFor && ((_explored._length__plain_text / _global__exploreNodeToBuildHTMLFor._length__plain_text) > 0.1))):
break;
default:
$R.debugOutline(_node, ‘clean-after’, ‘missing-density’);
_global__the_html = _global__the_html.substr(0, _pos__start__before);
return;
}
}
// return
return;
};
// actually do it
_recursive(_nodeToBuildHTMLFor);
// return html
return _global__the_html;
};
// article title marker
// ====================
$R.articleTitleMarker__start = ‘
‘;
$R.articleTitleMarker__end = ‘
‘;
// article title check function
// ============================
$R.getContent__find__hasIsolatedTitleInHTML = function (_html)
{
return (_html.substr(0, $R.articleTitleMarker__start.length) == $R.articleTitleMarker__start);
};
// article title get function
// ============================
$R.getContent__find__getIsolatedTitleInHTML = function (_html)
{
// is it there?
if ($R.getContent__find__hasIsolatedTitleInHTML(_html)); else { return ”; }
// regex
var
_getTitleRegex = new RegExp($R.articleTitleMarker__start + ‘(.*?)’ + $R.articleTitleMarker__end, ‘i’),
_getTitleMatch = _html.match(_getTitleRegex)
;
// match?
if (_getTitleMatch); else { return ”; }
// return
return _getTitleMatch[1];
};
// find title in arbitrary html
// ============================
$R.getContent__find__isolateTitleInHTML = function (_html, _document_title)
{
// can’t just use (h1|h2|h3|etc) — we want to try them in a certain order
// =============================
var
_heading_pregs = [
/]*?>([\s\S]+?)/gi,
/]*?>([\s\S]+?)/gi,
/]*?>([\s\S]+?)/gi
],
_secondary_headings = ‘|h2|h3|h4|h5|h6|’,
_search_document_title = ‘ ‘ + _document_title.replace(/]+?>/gi, ”).replace(/\s+/gi, ‘ ‘) + ‘ ‘
;
// loop pregs
// ==========
for (var i=0, _i=_heading_pregs.length; i -1)):
// will continue loop
break;
default:
// measurements
var
_heading_end_pos = _heading_pregs[i].lastIndex,
_heading_start_pos = (_heading_end_pos – _match[0].length),
_heading_type = _match[1],
_heading_text = _match[2].replace(/]*>/gi, ”).replace(/[\n\r]+/gi, ”),
_heading_text_plain = _heading_text.replace(/]+?>/gi, ”).replace(/\s+/gi, ‘ ‘);
_heading_length = $R.measureText__getTextLength(_heading_text_plain),
_heading_words = [],
_to_heading_text = _html.substr(0, _heading_start_pos),
_to_heading_length = $R.measureText__getTextLength(_to_heading_text.replace(/]+?>/gi, ”).replace(/\s+/gi, ‘ ‘))
;
// return?
switch (true)
{
case (!(_heading_length > 5)):
case (!(_heading_length < (65 * 3))):
case (!(_to_heading_length -1)):
// words in this heading
_heading_words = _heading_text_plain.split(‘ ‘);
// count words present in title
for (var j=0, _j=_heading_words.length, _matched_words=”; j -1) {
_matched_words += _heading_words[j] + ‘ ‘;
}
}
// break continues for loop
// nothing goes to switch’s default
// ================================
// no break?
var _no_break = false;
switch (true)
{
// if it’s big enough, and it’s a substring of the title, it’s good
case ((_heading_length > 20) && (_search_document_title.indexOf(_heading_text_plain) > -1)):
// if it’s slightly smaler, but is exactly at the begging or the end
case ((_heading_length > 10) && ((_search_document_title.indexOf(_heading_text_plain) == 1) || (_search_document_title.indexOf(_heading_text_plain) == (_search_document_title.length – 1 – _heading_text_plain.length)))):
_no_break = true;
break;
}
// break?
var _break = false;
switch (true)
{
// no break?
case (_no_break):
break;
// heading too long? — if not h2
case ((_heading_length > ((_search_document_title.length – 2) * 2)) && (_heading_type != ‘h2’)):
// heading long enough?
case ((_heading_length < Math.ceil((_search_document_title.length – 2) * 0.50))):
// enough words matched?
case ((_heading_length < 25) && (_matched_words.length < Math.ceil(_heading_length * 0.75))):
case ((_heading_length < 50) && (_matched_words.length < Math.ceil(_heading_length * 0.65))):
case ((_matched_words.length ” ? $R.document.title : ”)
;
// get title
// =========
// has title already?
_foundHTML = $R.getContent__find__isolateTitleInHTML(_foundHTML, _documentTitle);
$R.articleTitle = $R.getContent__find__getIsolatedTitleInHTML(_foundHTML);
$R.debugPrint(‘TitleSource’, ‘target’);
// get html above?
if ($R.articleTitle > ”); else
{
// get html above target?
// ======================
// global vars:
// _found
// _foundHTML
// _documentTitle
// _aboveNodes
var
_prevNode = _found._targetCandidate.__node,
_prevHTML = ”,
_aboveHTML = ”,
_differentTargets = (_found._firstCandidate.__node != _found._targetCandidate.__node)
;
(function ()
{
while (true)
{
// the end?
switch (true)
{
case (_prevNode.tagName && (_prevNode.tagName.toLowerCase() == ‘body’)):
case (_differentTargets && (_prevNode == _found._firstCandidate.__node)):
// enough is enough
return;
}
// up or sideways?
if (_prevNode.previousSibling); else
{
_prevNode = _prevNode.parentNode;
continue;
}
// previous
_prevNode = _prevNode.previousSibling;
// outline — element might be re-outlined, when buildHTML is invoked
if ($R.debug) { $R.debugOutline(_prevNode, ‘target’, ‘add-above’); }
// get html; add
_prevHTML = $R.getContent__buildHTMLForNode(_prevNode, ‘above-the-target’);
_aboveHTML = _prevHTML + _aboveHTML;
_aboveNodes.unshift(_prevNode);
// isolate title
_aboveHTML = $R.getContent__find__isolateTitleInHTML(_aboveHTML, _documentTitle);
// finished?
switch (true)
{
case ($R.measureText__getTextLength(_aboveHTML.replace(/]+?>/gi, ”).replace(/\s+/gi, ‘ ‘)) > (65 * 3 * 3)):
case ($R.getContent__find__hasIsolatedTitleInHTML(_aboveHTML)):
return;
}
}
})();
// is what we found any good?
// ==========================
switch (true)
{
case ($R.getContent__find__hasIsolatedTitleInHTML(_aboveHTML)):
case (_differentTargets && (_aboveHTML.split(‘<a ').length < 3) && ($R.measureText__getTextLength(_aboveHTML.replace(/]+?>/gi, ”).replace(/\s+/gi, ‘ ‘)) ”); else
{
// if all else failed, get document title
// ======================================
// global vars:
// _foundHTML
// _documentTitle
(function ()
{
// return?
// =======
if (_documentTitle > ”); else { return; }
// vars
var
_doc_title_parts = [],
_doc_title_pregs =
[
/( [-][-] |( [-] )|( [>][>] )|( [<][<] )|( [|] )|( [\/] ))/i,
/(([:] ))/i
]
;
// loop through pregs
// ==================
for (var i=0, _i=_doc_title_pregs.length; i 1) { break; }
}
// sort title parts — longer goes higher up — i.e. towards 0
// ================
_doc_title_parts.sort(function (a, b)
{
switch (true)
{
case (a.length > b.length): return -1;
case (a.length 1 ? _doc_title_parts[0] : _documentTitle)
+ $R.articleTitleMarker__end
+ _foundHTML
;
})();
$R.articleTitle = $R.getContent__find__getIsolatedTitleInHTML(_foundHTML);
$R.debugPrint(‘TitleSource’, ‘document_title’);
}
}
// display
// =======
$R.$pages.html(”);
$R.displayPageHTML(_foundHTML, 1, $R.win.location.href);
// remember
// ========
$R.debugRemember[‘theTarget’] = _found._targetCandidate.__node;
$R.debugRemember[‘firstCandidate’] = _found._firstCandidate.__node;
// next
// ====
$R.nextPage__firstFragment__firstPage = _firstFragmentBefore;
$R.nextPage__firstFragment__lastPage = $R.getContent__nextPage__getFirstFragment(_foundHTML);;
$R.nextPage__loadedPages = [$R.win.location.href];
$R.getContent__nextPage__find($R.win, _found._links);
// return
return true;
};
$R.getContent__findInPage = function (_pageWindow)
{
// calculations
// ============
var
_firstCandidate = false,
_secondCandidate = false,
_targetCandidate = false
;
$R.debugTimerStart(‘ExploreAndGetStuff’);
var _stuff = $R.getContent__exploreNodeAndGetStuff(_pageWindow.document.body);
$R.debugPrint(‘ExploreAndGetStuff’, $R.debugTimerEnd()+’ms’);
$R.debugTimerStart(‘ProcessFirst’);
var _processedCandidates = $R.getContent__processCandidates(_stuff._candidates);
_firstCandidate = _processedCandidates[0];
_targetCandidate = _firstCandidate;
$R.debugPrint(‘ProcessFirst’, $R.debugTimerEnd()+’ms’);
// debug
if ($R.debug)
{
// debug first candidates
$R.log(‘First 5 Main Candidates:’);
for (var x in _processedCandidates)
{
if (x == 5) { break; }
$R.log(_processedCandidates[x], _processedCandidates[x].__node);
}
// highlight first
$R.debugOutline(_firstCandidate.__node, ‘target’, ‘first’);
}
// in case we stop
$R.debugPrint(‘Target’, ‘first’);
// do second?
switch (true)
{
case (!(_firstCandidate._count__containers > 0)):
case (!(_firstCandidate._count__candidates > 0)):
case (!(_firstCandidate._count__pieces > 0)):
case (!(_firstCandidate._count__containers > 25)):
break;
default:
$R.debugTimerStart(‘ProcessSecond’);
var _processedCandidatesSecond = $R.getContent__processCandidatesSecond(_processedCandidates);
_secondCandidate = _processedCandidatesSecond[0];
$R.debugPrint(‘ProcessSecond’, $R.debugTimerEnd()+’ms’);
// they’re the same
if (_firstCandidate.__node == _secondCandidate.__node) { break; }
// debug
if ($R.debug)
{
// log second candidates
$R.log(‘First 5 Second Candidates:’);
for (var x in _processedCandidatesSecond)
{
if (x == 5) { break; }
$R.log(_processedCandidatesSecond[x], _processedCandidatesSecond[x].__node);
}
// highlight second
$R.debugOutline(_secondCandidate.__node, ‘target’, ‘second’);
}
// compute again
// =============
_firstCandidate[‘__points_history_final’] = $R.getContent__computePointsForCandidateThird(_firstCandidate, _firstCandidate);
_firstCandidate[‘__points_final’] = _firstCandidate.__points_history_final[0];
_secondCandidate[‘__points_history_final’] = $R.getContent__computePointsForCandidateThird(_secondCandidate, _firstCandidate);
_secondCandidate[‘__points_final’] = _secondCandidate.__points_history_final[0];
// log results
// ===========
if ($R.debug)
{
$R.log(‘The 2 Candidates:’);
$R.log(_firstCandidate);
$R.log(_secondCandidate);
}
// are we selecting _second?
// =========================
switch (true)
{
case ((_secondCandidate.__candidate_details._count__lines_of_65_characters 1):
case ((_secondCandidate.__candidate_details._count__lines_of_65_characters > 20) && (_secondCandidate.__points_final / _firstCandidate.__points_final) > 0.9):
case ((_secondCandidate.__candidate_details._count__lines_of_65_characters > 50) && (_secondCandidate.__points_final / _firstCandidate.__points_final) > 0.75):
_targetCandidate = _secondCandidate;
$R.debugPrint(‘Target’, ‘second’);
break;
}
// print points
// ============
if ($R.debug)
{
$R.debugPrint(‘PointsFirst’, _firstCandidate[‘__points_history_final’][0].toFixed(2));
$R.debugPrint(‘PointsSecond’, _secondCandidate[‘__points_history_final’][0].toFixed(2));
}
break;
}
// highlight target
// ================
if ($R.debug)
{
$(_targetCandidate.__node).css({
‘box-shadow’:
‘inset 0px 0px 50px rgba(255, 255, 0, 0.95), 0px 0px 50px rgba(255, 255, 0, 0.95)’
});
}
// get html
// ========
$R.debugTimerStart(‘BuildHTML’);
var _html = $R.getContent__buildHTMLForNode(_targetCandidate.__node, ‘the-target’);
_html = _html.substr((_html.indexOf(‘>’)+1))
_html = _html.substr(0, _html.lastIndexOf(‘<'));
$R.debugPrint('BuildHTML', $R.debugTimerEnd()+'ms');
$R.debugTimerStart('BuildHTMLPregs');
_html = _html.replace(/]*)>(\s* )+/gi, ”);
_html = _html.replace(/( \s*)+/gi, ”);
_html = _html.replace(/( \s*)+]*)>/gi, ”);
_html = _html.replace(/(\s* )+/gi, ”);
_html = _html.replace(/(\s*\s*)+/gi, ‘‘);
_html = _html.replace(/( \s* \s*)+/gi, ‘
‘);
$R.debugPrint(‘BuildHTMLPregs’, $R.debugTimerEnd()+’ms’);
// return
// ======
return {
‘_html’: _html,
‘_links’: _stuff._links,
‘_targetCandidate’: _targetCandidate,
‘_firstCandidate’: _firstCandidate
};
};
// get first page fragment
// =======================
$R.getContent__nextPage__getFirstFragment = function (_html)
{
// remove all tags
_html = _html.replace(/]+?>/gi, ”);
// normalize spaces
_html = _html.replace(/\s+/gi, ‘ ‘);
// return first 1000 characters
return _html.substr(0, 2000);
};
// get link parts
// ==============
// substr starting with the first slash after //
$R.getURLPath = function (_url)
{
return _url.substr(_url.indexOf(‘/’, (_url.indexOf(‘//’) + 2)));
};
// substr until the first slash after //
$R.getURLDomain = function (_url)
{
return _url.substr(0, _url.indexOf(‘/’, (_url.indexOf(‘//’) + 2)))
};
// find
// ====
$R.getContent__nextPage__find = function (_currentPageWindow, _linksInCurrentPage)
{
// page id
var _pageNr = ($R.nextPage__loadedPages.length + 1);
// get
// ===
var _possible = [];
if (_possible.length > 0); else { _possible = $R.getContent__nextPage__find__possible(_currentPageWindow, _linksInCurrentPage, 0.5); }
//if (_possible.length > 0); else { _possible = $R.getContent__nextPage__find__possible(_currentPageWindow, _linksInCurrentPage, 0.50); }
// none
if (_possible.length > 0); else
{ if ($R.debug) { $R.log(‘no next link found’); } return; }
if ($R.debug) { $R.log(‘possible next’, _possible); }
// the one
// =======
var _nextLink = false;
// next keyword?
// =============
(function ()
{
if (_nextLink) { return; }
for (var i=0, _i=_possible.length; i<_i; i++)
{
for (var j=0, _j=$R.nextPage__captionKeywords.length; j -1)
{
// length
// ======
if (_possible[i]._caption.length > $R.nextPage__captionKeywords[j].length * 2)
{ continue; }
// not keywords
// ============
for (var z=0, _z=$R.nextPage__captionKeywords__not.length; z -1)
{ _nextLink = false; return; }
}
// got it
// ======
_nextLink = _possible[i];
return;
}
}
}
})();
// caption matched page number
// ===========================
(function ()
{
if (_nextLink) { return; }
for (var i=0, _i=_possible.length; i<_i; i++)
{
if (_possible[i]._caption == (''+_pageNr))
{ _nextLink = _possible[i]; return; }
}
})();
// next keyword in title
// =====================
(function ()
{
if (_nextLink) { return; }
for (var i=0, _i=_possible.length; i ”); else { continue; }
if ($R.measureText__getTextLength(_possible[i]._caption) <= 2); else { continue; }
for (var j=0, _j=$R.nextPage__captionKeywords.length; j -1)
{
// length
// ======
if (_possible[i]._title.length > $R.nextPage__captionKeywords[j].length * 2)
{ continue; }
// not keywords
// ============
for (var z=0, _z=$R.nextPage__captionKeywords__not.length; z -1)
{ _nextLink = false; return; }
}
// got it
// ======
_nextLink = _possible[i];
return;
}
}
}
})();
// return?
// =======
if (_nextLink); else { return; }
// mark
// ====
$R.debugPrint(‘NextPage’, ‘true’);
if ($R.debug)
{
$R.debugOutline(_nextLink._node, ‘target’, ‘next-page’);
$R.log(‘NextPage Link’, _nextLink, _nextLink._node);
}
// process page
// ============
$R.getContent__nextPage__loadToFrame(_pageNr, _nextLink._href);
$R.nextPage__loadedPages.push(_nextLink._href);
};
// find with similarity
// ====================
$R.getContent__nextPage__find__possible = function (_currentPageWindow, _linksInCurrentPage, _distanceFactor)
{
var
_mainPageHref = $R.win.location.href,
_mainPageDomain = $R.getURLDomain(_mainPageHref),
_mainPagePath = $R.getURLPath(_mainPageHref)
;
var _links = $.map
(
_linksInCurrentPage,
function (_element, _index)
{
var
_href = _element.__node.href,
_path = $R.getURLPath(_href),
_title = (_element.__node.title > ” ? _element.__node.title.toLowerCase() : ”),
_caption = _element.__node.innerHTML.replace(/]+?>/gi, ”).replace(/\&[^\&\s;]{1,10};/gi, ”).replace(/\s+/gi, ‘ ‘).replace(/^ /, ”).replace(/ $/, ”).toLowerCase(),
_distance = $R.levenshteinDistance(_mainPagePath, _path)
;
var _caption2 = ”;
for (var i=0, _i=_caption.length, _code=0; i 127 ? (‘&#’+_code+’;’) : _caption.charAt(i));
}
_caption = _caption2;
switch (true)
{
case (!(_href > ”)):
case (_mainPageHref.length > _href.length):
case (_mainPageDomain != $R.getURLDomain(_href)):
case (_href.substr(_mainPageHref.length).substr(0, 1) == ‘#’):
case (_distance > Math.ceil(_distanceFactor * _path.length)):
return null;
default:
// skip if already loaded as next page
for (var i=0, _i=$R.nextPage__loadedPages.length; i<_i; i++)
{ if ($R.nextPage__loadedPages[i] == _href) { return null; } }
// return
return {
'_node': _element.__node,
'_href': _href,
'_title': _title,
'_caption': _caption,
'_distance': _distance
};
}
}
);
// sort — the less points, the closer to position 0
// ====
_links.sort(function (a, b)
{
switch (true)
{
case (a._distance b._distance): return 1;
default: return 0;
}
});
// return
return _links;
};
// load to frame
// =============
$R.getContent__nextPage__loadToFrame = function (_pageNr, _nextPageURL)
{
// do ajax
// =======
$.ajax
({
‘url’ : _nextPageURL,
‘type’ : ‘GET’,
‘dataType’ : ‘html’,
‘async’ : true,
‘timeout’: (10 * 1000),
//’headers’: { ‘Referrer’: _nextPageURL },
‘success’ : function (_response, _textStatus, _xhr) { $R.getContent__nextPage__ajaxComplete(_pageNr, _response, _textStatus, _xhr); },
‘error’ : function (_xhr, _textStatus, _error) { $R.getContent__nextPage__ajaxError(_pageNr, _xhr, _textStatus, _error); }
});
};
// ajax calbacks
// =============
$R.getContent__nextPage__ajaxError = function (_pageNr, _xhr, _textStatus, _error)
{
};
$R.getContent__nextPage__ajaxComplete = function (_pageNr, _response, _textStatus, _xhr)
{
// valid?
// ======
if (_response > ”); else { return; }
// script
// ======
var _script = ”
+ ”
+ ‘ function __this_page_loaded()’
+ ‘ {‘
+ ‘ window.setTimeout(‘
+ ‘ function () {‘
+ ($R.component ? ‘window.parent.’ : ‘window.parent.parent.’)
+ ‘$readable.getContent__nextPage__loadedInFrame(“‘+_pageNr+'”, window); }, ‘
+ ‘ 250’
+ ‘ );’
+ ‘ } ‘
+ ‘ if (document.readyState); else { __this_page_loaded(); } ‘
+ ‘ function __this_page_loaded_ready(delayedNrTimes)’
+ ‘ {‘
+ ‘ if (document.readyState != “complete” && delayedNrTimes
‘ ; // get html // ======== var _html = _response; // normalize // ========= _html = _html.replace(/<\s+/gi, ‘<‘); _html = _html.replace(/\s+>/gi, ‘>’); _html = _html.replace(/\s+\/>/gi, ‘/>’); // remove // ====== _html = _html.replace(/<script[^>]*?>([\s\S]*?)<\/script>/gi, ”); _html = _html.replace(/<script[^>]*?\/>/gi, ”); _html = _html.replace(/<noscript[^>]*?>([\s\S]*?)<\/noscript>/gi, ”); _html = _html.replace(/<onload=”*?” id=”nextPageFrame__’+_pageNr+'” ‘=”” +=”” frameborder=”0″ scrolling=”no” ‘<iframe’=”” $r.$nextpages.append(”=”” ==”==============” frame=”” append=”” body’);=”” _script+'<=”” _html=”_html.replace(/<\/body/i,” handler=”” load=”” add=”” ”);=”” gi,=””>’ ); // write to frame // ============== var _doc = $(‘#nextPageFrame__’+_pageNr).contents().get(0); _doc.open(); _doc.write(_html); _doc.close(); }; // loaded in frame // =============== $R.getContent__nextPage__loadedInFrame = function (_pageNr, _pageWindow) { // find // ==== var _found = $R.getContent__findInPage(_pageWindow), _foundHTML = _found._html, _removeTitleRegex = new RegExp($R.articleTitleMarker__start + ‘(.*?)’ + $R.articleTitleMarker__end, ‘i’) ; // get first fragment // ================== var _firstFragment = $R.getContent__nextPage__getFirstFragment(_foundHTML); // gets first 2000 characters // diff set at 100 — 0.05 switch (true) { case ($R.levenshteinDistance(_firstFragment, $R.nextPage__firstFragment__firstPage) < 100): case ($R.levenshteinDistance(_firstFragment, $R.nextPage__firstFragment__lastPage) < 100): // mark $R.debugPrint(‘NextPage’, ‘false’); // mark again if ($R.debug) { $(‘#debugOutput__value__NextPage’).html(‘false’); } // pop page $R.nextPage__loadedPages.pop(); // break return false; default: // add to first fragemnts $R.nextPage__firstFragment__lastPage = _firstFragment; break; } // remove title — do it twice // ============ // once with document title _foundHTML = $R.getContent__find__isolateTitleInHTML(_foundHTML, ($R.document.title > ” ? $R.document.title : ”)); _foundHTML = _foundHTML.replace(_removeTitleRegex, ”); // once with article title _foundHTML = $R.getContent__find__isolateTitleInHTML(_foundHTML, $R.articleTitle); _foundHTML = _foundHTML.replace(_removeTitleRegex, ”); // display // ======= $R.displayPageHTML(_foundHTML, _pageNr, _pageWindow.location.href); // next // ==== $R.getContent__nextPage__find(_pageWindow, _found._links); }; // rewrites // ======== // rewrite displayPageHTML — for multi-page articles // ======================= $R.displayPageHTML = function (_processedPageHTML, _pageNr, _pageURL) { // skip first if (_pageNr > 1); else { return; } // push to pages $C._nextPages.push({ ‘_html’: _processedPageHTML, ‘_url’: _pageURL }); }; // rewrite makeRTL — for right-to-left pages // =============== $R.makeRTL = function () { $R.rtl = true; }; $R.makeNotRTL = function () { $R.rtl = false; } // set component object // ==================== window.ClearlyComponent = $C; window.$readable = $R; }
// <![CDATA[
/*
http://www.JSON.org/json2.js
2008-11-19
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the object holding the key.
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(—current time—)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] – 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
*/
/*jslint evil: true */
/*global JSON */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (!this.JSON) {
JSON = {};
}
(function () {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ?
'"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' :
'"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0 ? '[]' :
gap ? '[\n' + gap +
partial.join(',\n' + gap) + '\n' +
mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === 'string') {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0 ? '{}' :
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
mind + '}' : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i // <![CDATA[
/*mousewheel*/
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[–c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[–a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[–a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
/*custom scrollbar*/
(function(c){var b={init:function(e){var f={set_width:false,set_height:false,horizontalScroll:false,scrollInertia:950,mouseWheel:true,mouseWheelPixels:"auto",autoDraggerLength:true,autoHideScrollbar:false,alwaysShowScrollbar:false,snapAmount:null,snapOffset:0,scrollButtons:{enable:false,scrollType:"continuous",scrollSpeed:"auto",scrollAmount:40},advanced:{updateOnBrowserResize:true,updateOnContentResize:false,autoExpandHorizontalScroll:false,autoScrollOnFocus:true,normalizeMouseWheelDelta:false},contentTouchScroll:true,callbacks:{onScrollStart:function(){},onScroll:function(){},onTotalScroll:function(){},onTotalScrollBack:function(){},onTotalScrollOffset:0,onTotalScrollBackOffset:0,whileScrolling:function(){}},theme:"light"},e=c.extend(true,f,e);return this.each(function(){var m=c(this);if(e.set_width){m.css("width",e.set_width)}if(e.set_height){m.css("height",e.set_height)}if(!c(document).data("mCustomScrollbar-index")){c(document).data("mCustomScrollbar-index","1")}else{var t=parseInt(c(document).data("mCustomScrollbar-index"));c(document).data("mCustomScrollbar-index",t+1)}m.wrapInner("“).addClass(“mCustomScrollbar _mCS_”+c(document).data(“mCustomScrollbar-index”));var g=m.children(“.mCustomScrollBox”);if(e.horizontalScroll){g.addClass(“mCSB_horizontal”).wrapInner(““);var k=g.children(“.mCSB_h_wrapper”);k.wrapInner(““).children(“.mCSB_container”).css({width:k.children().outerWidth(),position:”relative”}).unwrap()}else{g.wrapInner(““)}var o=g.children(“.mCSB_container”);if(c.support.touch){o.addClass(“mCS_touch”)}o.after(“
“);var l=g.children(“.mCSB_scrollTools”),h=l.children(“.mCSB_draggerContainer”),q=h.children(“.mCSB_dragger”);if(e.horizontalScroll){q.data(“minDraggerWidth”,q.width())}else{q.data(“minDraggerHeight”,q.height())}if(e.scrollButtons.enable){if(e.horizontalScroll){l.prepend(““).append(““)}else{l.prepend(““).append(““)}}g.bind(“scroll”,function(){if(!m.is(“.mCS_disabled”)){g.scrollTop(0).scrollLeft(0)}});m.data({mCS_Init:true,mCustomScrollbarIndex:c(document).data(“mCustomScrollbar-index”),horizontalScroll:e.horizontalScroll,scrollInertia:e.scrollInertia,scrollEasing:”mcsEaseOut”,mouseWheel:e.mouseWheel,mouseWheelPixels:e.mouseWheelPixels,autoDraggerLength:e.autoDraggerLength,autoHideScrollbar:e.autoHideScrollbar,alwaysShowScrollbar:e.alwaysShowScrollbar,snapAmount:e.snapAmount,snapOffset:e.snapOffset,scrollButtons_enable:e.scrollButtons.enable,scrollButtons_scrollType:e.scrollButtons.scrollType,scrollButtons_scrollSpeed:e.scrollButtons.scrollSpeed,scrollButtons_scrollAmount:e.scrollButtons.scrollAmount,autoExpandHorizontalScroll:e.advanced.autoExpandHorizontalScroll,autoScrollOnFocus:e.advanced.autoScrollOnFocus,normalizeMouseWheelDelta:e.advanced.normalizeMouseWheelDelta,contentTouchScroll:e.contentTouchScroll,onScrollStart_Callback:e.callbacks.onScrollStart,onScroll_Callback:e.callbacks.onScroll,onTotalScroll_Callback:e.callbacks.onTotalScroll,onTotalScrollBack_Callback:e.callbacks.onTotalScrollBack,onTotalScroll_Offset:e.callbacks.onTotalScrollOffset,onTotalScrollBack_Offset:e.callbacks.onTotalScrollBackOffset,whileScrolling_Callback:e.callbacks.whileScrolling,bindEvent_scrollbar_drag:false,bindEvent_content_touch:false,bindEvent_scrollbar_click:false,bindEvent_mousewheel:false,bindEvent_buttonsContinuous_y:false,bindEvent_buttonsContinuous_x:false,bindEvent_buttonsPixels_y:false,bindEvent_buttonsPixels_x:false,bindEvent_focusin:false,bindEvent_autoHideScrollbar:false,mCSB_buttonScrollRight:false,mCSB_buttonScrollLeft:false,mCSB_buttonScrollDown:false,mCSB_buttonScrollUp:false});if(e.horizontalScroll){if(m.css(“max-width”)!==”none”){if(!e.advanced.updateOnContentResize){e.advanced.updateOnContentResize=true}}}else{if(m.css(“max-height”)!==”none”){var s=false,r=parseInt(m.css(“max-height”));if(m.css(“max-height”).indexOf(“%”)>=0){s=r,r=m.parent().height()*s/100}m.css(“overflow”,”hidden”);g.css(“max-height”,r)}}m.mCustomScrollbar(“update”);if(e.advanced.updateOnBrowserResize){var i,j=c(window).width(),u=c(window).height();c(window).bind(“resize.”+m.data(“mCustomScrollbarIndex”),function(){if(i){clearTimeout(i)}i=setTimeout(function(){if(!m.is(“.mCS_disabled”)&&!m.is(“.mCS_destroyed”)){var w=c(window).width(),v=c(window).height();if(j!==w||u!==v){if(m.css(“max-height”)!==”none”&&s){g.css(“max-height”,m.parent().height()*s/100)}m.mCustomScrollbar(“update”);j=w;u=v}}},150)})}if(e.advanced.updateOnContentResize){var p;if(e.horizontalScroll){var n=o.outerWidth()}else{var n=o.outerHeight()}p=setInterval(function(){if(e.horizontalScroll){if(e.advanced.autoExpandHorizontalScroll){o.css({position:”absolute”,width:”auto”}).wrap(““).css({width:o.outerWidth(),position:”relative”}).unwrap()}var v=o.outerWidth()}else{var v=o.outerHeight()}if(v!=n){m.mCustomScrollbar(“update”);n=v}},300)}})},update:function(){var n=c(this),k=n.children(“.mCustomScrollBox”),q=k.children(“.mCSB_container”);q.removeClass(“mCS_no_scrollbar”);n.removeClass(“mCS_disabled mCS_destroyed”);k.scrollTop(0).scrollLeft(0);var y=k.children(“.mCSB_scrollTools”),o=y.children(“.mCSB_draggerContainer”),m=o.children(“.mCSB_dragger”);if(n.data(“horizontalScroll”)){var A=y.children(“.mCSB_buttonLeft”),t=y.children(“.mCSB_buttonRight”),f=k.width();if(n.data(“autoExpandHorizontalScroll”)){q.css({position:”absolute”,width:”auto”}).wrap(““).css({width:q.outerWidth(),position:”relative”}).unwrap()}var z=q.outerWidth()}else{var w=y.children(“.mCSB_buttonUp”),g=y.children(“.mCSB_buttonDown”),r=k.height(),i=q.outerHeight()}if(i>r&&!n.data(“horizontalScroll”)){y.css(“display”,”block”);var s=o.height();if(n.data(“autoDraggerLength”)){var u=Math.round(r/i*s),l=m.data(“minDraggerHeight”);if(u=s-10){var p=s-10;m.css({height:p})}else{m.css({height:u})}}m.children(“.mCSB_dragger_bar”).css({“line-height”:m.height()+”px”})}var B=m.height(),x=(i-r)/(s-B);n.data(“scrollAmount”,x).mCustomScrollbar(“scrolling”,k,q,o,m,w,g,A,t);var D=Math.abs(q.position().top);n.mCustomScrollbar(“scrollTo”,D,{scrollInertia:0,trigger:”internal”})}else{if(z>f&&n.data(“horizontalScroll”)){y.css(“display”,”block”);var h=o.width();if(n.data(“autoDraggerLength”)){var j=Math.round(f/z*h),C=m.data(“minDraggerWidth”);if(j=h-10){var e=h-10;m.css({width:e})}else{m.css({width:j})}}}var v=m.width(),x=(z-f)/(h-v);n.data(“scrollAmount”,x).mCustomScrollbar(“scrolling”,k,q,o,m,w,g,A,t);var D=Math.abs(q.position().left);n.mCustomScrollbar(“scrollTo”,D,{scrollInertia:0,trigger:”internal”})}else{k.unbind(“mousewheel focusin”);if(n.data(“horizontalScroll”)){m.add(q).css(“left”,0)}else{m.add(q).css(“top”,0)}if(n.data(“alwaysShowScrollbar”)){if(!n.data(“horizontalScroll”)){m.css({height:o.height()})}else{if(n.data(“horizontalScroll”)){m.css({width:o.width()})}}}else{y.css(“display”,”none”);q.addClass(“mCS_no_scrollbar”)}n.data({bindEvent_mousewheel:false,bindEvent_focusin:false})}}},scrolling:function(i,q,n,k,A,f,D,w){var l=c(this);if(!l.data(“bindEvent_scrollbar_drag”)){var o,p,C,z,e;if(c.support.pointer){C=”pointerdown”;z=”pointermove”;e=”pointerup”}else{if(c.support.msPointer){C=”MSPointerDown”;z=”MSPointerMove”;e=”MSPointerUp”}}if(c.support.pointer||c.support.msPointer){k.bind(C,function(K){K.preventDefault();l.data({on_drag:true});k.addClass(“mCSB_dragger_onDrag”);var J=c(this),M=J.offset(),I=K.originalEvent.pageX-M.left,L=K.originalEvent.pageY-M.top;if(I0&&L0){o=L;p=I}});c(document).bind(z+”.”+l.data(“mCustomScrollbarIndex”),function(K){K.preventDefault();if(l.data(“on_drag”)){var J=k,M=J.offset(),I=K.originalEvent.pageX-M.left,L=K.originalEvent.pageY-M.top;G(o,p,L,I)}}).bind(e+”.”+l.data(“mCustomScrollbarIndex”),function(x){l.data({on_drag:false});k.removeClass(“mCSB_dragger_onDrag”)})}else{k.bind(“mousedown touchstart”,function(K){K.preventDefault();K.stopImmediatePropagation();var J=c(this),N=J.offset(),I,M;if(K.type===”touchstart”){var L=K.originalEvent.touches[0]||K.originalEvent.changedTouches[0];I=L.pageX-N.left;M=L.pageY-N.top}else{l.data({on_drag:true});k.addClass(“mCSB_dragger_onDrag”);I=K.pageX-N.left;M=K.pageY-N.top}if(I0&&M0){o=M;p=I}}).bind(“touchmove”,function(K){K.preventDefault();K.stopImmediatePropagation();var N=K.originalEvent.touches[0]||K.originalEvent.changedTouches[0],J=c(this),M=J.offset(),I=N.pageX-M.left,L=N.pageY-M.top;G(o,p,L,I)});c(document).bind(“mousemove.”+l.data(“mCustomScrollbarIndex”),function(K){if(l.data(“on_drag”)){var J=k,M=J.offset(),I=K.pageX-M.left,L=K.pageY-M.top;G(o,p,L,I)}}).bind(“mouseup.”+l.data(“mCustomScrollbarIndex”),function(x){l.data({on_drag:false});k.removeClass(“mCSB_dragger_onDrag”)})}l.data({bindEvent_scrollbar_drag:true})}function G(J,K,L,I){if(l.data(“horizontalScroll”)){l.mCustomScrollbar(“scrollTo”,(k.position().left-(K))+I,{moveDragger:true,trigger:”internal”})}else{l.mCustomScrollbar(“scrollTo”,(k.position().top-(J))+L,{moveDragger:true,trigger:”internal”})}}if(c.support.touch&&l.data(“contentTouchScroll”)){if(!l.data(“bindEvent_content_touch”)){var m,E,s,t,v,F,H;q.bind(“touchstart”,function(x){x.stopImmediatePropagation();m=x.originalEvent.touches[0]||x.originalEvent.changedTouches[0];E=c(this);s=E.offset();v=m.pageX-s.left;t=m.pageY-s.top;F=t;H=v});q.bind(“touchmove”,function(x){x.preventDefault();x.stopImmediatePropagation();m=x.originalEvent.touches[0]||x.originalEvent.changedTouches[0];E=c(this).parent();s=E.offset();v=m.pageX-s.left;t=m.pageY-s.top;if(l.data(“horizontalScroll”)){l.mCustomScrollbar(“scrollTo”,H-v,{trigger:”internal”})}else{l.mCustomScrollbar(“scrollTo”,F-t,{trigger:”internal”})}})}}if(!l.data(“bindEvent_scrollbar_click”)){n.bind(“click”,function(I){var x=(I.pageY-n.offset().top)*l.data(“scrollAmount”),y=c(I.target);if(l.data(“horizontalScroll”)){x=(I.pageX-n.offset().left)*l.data(“scrollAmount”)}if(y.hasClass(“mCSB_draggerContainer”)||y.hasClass(“mCSB_draggerRail”)){l.mCustomScrollbar(“scrollTo”,x,{trigger:”internal”,scrollEasing:”draggerRailEase”})}});l.data({bindEvent_scrollbar_click:true})}if(l.data(“mouseWheel”)){if(!l.data(“bindEvent_mousewheel”)){i.bind(“mousewheel”,function(K,M){var J,I=l.data(“mouseWheelPixels”),x=Math.abs(q.position().top),L=k.position().top,y=n.height()-k.height();if(l.data(“normalizeMouseWheelDelta”)){if(M0&&L!==0)||(M<0&&L!==y)){K.preventDefault();K.stopImmediatePropagation()}J=x-(M*I);l.mCustomScrollbar("scrollTo",J,{trigger:"internal"})});l.data({bindEvent_mousewheel:true})}}if(l.data("scrollButtons_enable")){if(l.data("scrollButtons_scrollType")==="pixels"){if(l.data("horizontalScroll")){w.add(D).unbind("mousedown touchstart MSPointerDown pointerdown mouseup MSPointerUp pointerup mouseout MSPointerOut pointerout touchend",j,h);l.data({bindEvent_buttonsContinuous_x:false});if(!l.data("bindEvent_buttonsPixels_x")){w.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().left)+l.data("scrollButtons_scrollAmount"))});D.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().left)-l.data("scrollButtons_scrollAmount"))});l.data({bindEvent_buttonsPixels_x:true})}}else{f.add(A).unbind("mousedown touchstart MSPointerDown pointerdown mouseup MSPointerUp pointerup mouseout MSPointerOut pointerout touchend",j,h);l.data({bindEvent_buttonsContinuous_y:false});if(!l.data("bindEvent_buttonsPixels_y")){f.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().top)+l.data("scrollButtons_scrollAmount"))});A.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().top)-l.data("scrollButtons_scrollAmount"))});l.data({bindEvent_buttonsPixels_y:true})}}function r(x){if(!k.data("preventAction")){k.data("preventAction",true);l.mCustomScrollbar("scrollTo",x,{trigger:"internal"})}}}else{if(l.data("horizontalScroll")){w.add(D).unbind("click");l.data({bindEvent_buttonsPixels_x:false});if(!l.data("bindEvent_buttonsContinuous_x")){w.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollRight:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().left)+x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var j=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollRight"))};w.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",j);D.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollLeft:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().left)-x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var h=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollLeft"))};D.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",h);l.data({bindEvent_buttonsContinuous_x:true})}}else{f.add(A).unbind("click");l.data({bindEvent_buttonsPixels_y:false});if(!l.data("bindEvent_buttonsContinuous_y")){f.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollDown:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().top)+x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var u=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollDown"))};f.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",u);A.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollUp:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().top)-x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var g=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollUp"))};A.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",g);l.data({bindEvent_buttonsContinuous_y:true})}}function B(){var x=l.data("scrollButtons_scrollSpeed");if(l.data("scrollButtons_scrollSpeed")==="auto"){x=Math.round((l.data("scrollInertia")+100)/40)}return x}}}if(l.data("autoScrollOnFocus")){if(!l.data("bindEvent_focusin")){i.bind("focusin",function(){i.scrollTop(0).scrollLeft(0);var x=c(document.activeElement);if(x.is("input,textarea,select,button,a[tabindex],area,object")){var J=q.position().top,y=x.position().top,I=i.height()-x.outerHeight();if(l.data("horizontalScroll")){J=q.position().left;y=x.position().left;I=i.width()-x.outerWidth()}if(J+yI){l.mCustomScrollbar(“scrollTo”,y,{trigger:”internal”})}}});l.data({bindEvent_focusin:true})}}if(l.data(“autoHideScrollbar”)&&!l.data(“alwaysShowScrollbar”)){if(!l.data(“bindEvent_autoHideScrollbar”)){i.bind(“mouseenter”,function(x){i.addClass(“mCS-mouse-over”);d.showScrollbar.call(i.children(“.mCSB_scrollTools”))}).bind(“mouseleave touchend”,function(x){i.removeClass(“mCS-mouse-over”);if(x.type===”mouseleave”){d.hideScrollbar.call(i.children(“.mCSB_scrollTools”))}});l.data({bindEvent_autoHideScrollbar:true})}}},scrollTo:function(e,f){var i=c(this),o={moveDragger:false,trigger:”external”,callbacks:true,scrollInertia:i.data(“scrollInertia”),scrollEasing:i.data(“scrollEasing”)},f=c.extend(o,f),p,g=i.children(“.mCustomScrollBox”),k=g.children(“.mCSB_container”),r=g.children(“.mCSB_scrollTools”),j=r.children(“.mCSB_draggerContainer”),h=j.children(“.mCSB_dragger”),t=draggerSpeed=f.scrollInertia,q,s,m,l;if(!k.hasClass(“mCS_no_scrollbar”)){i.data({mCS_trigger:f.trigger});if(i.data(“mCS_Init”)){f.callbacks=false}if(e||e===0){if(typeof(e)===”number”){if(f.moveDragger){p=e;if(i.data(“horizontalScroll”)){e=h.position().left*i.data(“scrollAmount”)}else{e=h.position().top*i.data(“scrollAmount”)}draggerSpeed=0}else{p=e/i.data(“scrollAmount”)}}else{if(typeof(e)===”string”){var v;if(e===”top”){v=0}else{if(e===”bottom”&&!i.data(“horizontalScroll”)){v=k.outerHeight()-g.height()}else{if(e===”left”){v=0}else{if(e===”right”&&i.data(“horizontalScroll”)){v=k.outerWidth()-g.width()}else{if(e===”first”){v=i.find(“.mCSB_container”).find(“:first”)}else{if(e===”last”){v=i.find(“.mCSB_container”).find(“:last”)}else{v=i.find(e)}}}}}}if(v.length===1){if(i.data(“horizontalScroll”)){e=v.position().left}else{e=v.position().top}p=e/i.data(“scrollAmount”)}else{p=e=v}}}if(i.data(“horizontalScroll”)){if(i.data(“onTotalScrollBack_Offset”)){s=-i.data(“onTotalScrollBack_Offset”)}if(i.data(“onTotalScroll_Offset”)){l=g.width()-k.outerWidth()+i.data(“onTotalScroll_Offset”)}if(p=j.width()-h.width()){p=j.width()-h.width();e=g.width()-k.outerWidth();clearInterval(i.data(“mCSB_buttonScrollRight”));if(!l){m=true}}else{e=-e}}var n=i.data(“snapAmount”);if(n){e=Math.round(e/n)*n-i.data(“snapOffset”)}d.mTweenAxis.call(this,h[0],”left”,Math.round(p),draggerSpeed,f.scrollEasing);d.mTweenAxis.call(this,k[0],”left”,Math.round(e),t,f.scrollEasing,{onStart:function(){if(f.callbacks&&!i.data(“mCS_tweenRunning”)){u(“onScrollStart”)}if(i.data(“autoHideScrollbar”)&&!i.data(“alwaysShowScrollbar”)){d.showScrollbar.call(r)}},onUpdate:function(){if(f.callbacks){u(“whileScrolling”)}},onComplete:function(){if(f.callbacks){u(“onScroll”);if(q||(s&&k.position().left>=s)){u(“onTotalScrollBack”)}if(m||(l&&k.position().left<=l)){u("onTotalScroll")}}h.data("preventAction",false);i.data("mCS_tweenRunning",false);if(i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")){if(!g.hasClass("mCS-mouse-over")){d.hideScrollbar.call(r)}}}})}else{if(i.data("onTotalScrollBack_Offset")){s=-i.data("onTotalScrollBack_Offset")}if(i.data("onTotalScroll_Offset")){l=g.height()-k.outerHeight()+i.data("onTotalScroll_Offset")}if(p=j.height()-h.height()){p=j.height()-h.height();e=g.height()-k.outerHeight();clearInterval(i.data(“mCSB_buttonScrollDown”));if(!l){m=true}}else{e=-e}}var n=i.data(“snapAmount”);if(n){e=Math.round(e/n)*n-i.data(“snapOffset”)}d.mTweenAxis.call(this,h[0],”top”,Math.round(p),draggerSpeed,f.scrollEasing);d.mTweenAxis.call(this,k[0],”top”,Math.round(e),t,f.scrollEasing,{onStart:function(){if(f.callbacks&&!i.data(“mCS_tweenRunning”)){u(“onScrollStart”)}if(i.data(“autoHideScrollbar”)&&!i.data(“alwaysShowScrollbar”)){d.showScrollbar.call(r)}},onUpdate:function(){if(f.callbacks){u(“whileScrolling”)}},onComplete:function(){if(f.callbacks){u(“onScroll”);if(q||(s&&k.position().top>=s)){u(“onTotalScrollBack”)}if(m||(l&&k.position().top=g._time){g._time=(j>g._time)?j+l-(j-g._time):j+l-1;if(g._time<j+1){g._time=j+1}}if(g._time0){g.currVal=k(g._time,r,m,f,o);s[i]=Math.round(g.currVal)+”px”}else{s[i]=h+”px”}p.call()}function e(){l=1000/60;g._time=j+l;_request=(!window.requestAnimationFrame)?function(z){u();return setTimeout(z,0.01)}:window.requestAnimationFrame;g._id=_request(x)}function q(){if(g._id==null){return}if(!window.requestAnimationFrame){clearTimeout(g._id)}else{window.cancelAnimationFrame(g._id)}g._id=null}function k(B,A,F,E,C){switch(C){case”linear”:return F*B/E+A;break;case”easeOutQuad”:B/=E;return -F*B*(B-2)+A;break;case”easeInOutQuad”:B/=E/2;if(B<1){return F/2*B*B+A}B–;return -F/2*(B*(B-2)-1)+A;break;case"easeOutCubic":B/=E;B–;return F*(B*B*B+1)+A;break;case"easeOutQuart":B/=E;B–;return -F*(B*B*B*B-1)+A;break;case"easeOutQuint":B/=E;B–;return F*(B*B*B*B*B+1)+A;break;case"easeOutCirc":B/=E;B–;return F*Math.sqrt(1-B*B)+A;break;case"easeOutSine":return F*Math.sin(B/E*(Math.PI/2))+A;break;case"easeOutExpo":return F*(-Math.pow(2,-10*B/E)+1)+A;break;case"mcsEaseOut":var D=(B/=E)*B,z=D*B;return A+F*(0.499999999999997*z*D+-2.5*D*D+5.5*z+-6.5*D+4*B);break;case"draggerRailEase":B/=E/2;if(B-1&&!window.requestAnimationFrame){window.requestAnimationFrame=window[f[e]+”RequestAnimationFrame”];window.cancelAnimationFrame=window[f[e]+”CancelAnimationFrame”]||window[f[e]+”CancelRequestAnimationFrame”]}}};d.rafPolyfill.call();c.support.touch=!!(“ontouchstart” in window);c.support.pointer=window.navigator.pointerEnabled;c.support.msPointer=window.navigator.msPointerEnabled;var a=(“https:”==document.location.protocol)?”https:”:”http:”;c.event.special.mousewheel||document.write(”);c.fn.mCustomScrollbar=function(e){if(b[e]){return b[e].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof e===”object”||!e){return b.init.apply(this,arguments)}else{c.error(“Method “+e+” does not exist”)}}}})(jQuery);
// ]]>// <![CDATA[
// HTML5 placeholder plugin version 1.01
// Copyright (c) 2010-The End of Time, Mike Taylor, http://miketaylr.com
// MIT Licensed: http://www.opensource.org/licenses/mit-license.php
//
// Enables cross-browser HTML5 placeholder for inputs, by first testing
// for a native implementation before building one.
//
//
// USAGE:
//$('input[placeholder]').placeholder();
//
(function($){
//feature detection
var hasPlaceholder = ‘placeholder’ in document.createElement(‘input’);
var placeholderClass = ‘evn-placeholder’;
//sniffy sniff sniff — just to give extra left padding for the older
//graphics for type=email and type=url
var isOldOpera = $.browser.opera && $.browser.version < 10.5;
$.fn.placeholder = function(options) {
//merge in passed in options, if any
var options = $.extend({}, $.fn.placeholder.defaults, options),
//cache the original 'left' value, for use by Opera later
o_left = options.placeholderCSS.left;
//first test for native placeholder support before continuing
//feature detection inspired by ye olde jquery 1.4 hawtness, with paul irish
return (hasPlaceholder) ? this : this.each(function() {
//local vars
var $this = $(this),
inputVal = $.trim($this.val()),
inputWidth = $this.width(),
inputHeight = $this.height(),
//grab the inputs id for the