Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public querySelectorAll(selector: string): HTMLElement[] {
if (!CACHED_CSS_SELECTORS.has(selector)) {
CACHED_CSS_SELECTORS.set(selector, cssSelect.compile(selector));
}
const matches: any[] = cssSelect(
CACHED_CSS_SELECTORS.get(selector) as cssSelect.CompiledQuery,
this._document.children
);
const result = matches.map((element) => {
return new HTMLElement(element, this);
});
return result;
}
function matcherFromSelector(declarations, selector) {
const match = CSSselect.compile(selector);
const specificity = calculateSpecificity(selector);
const properties = declarationsToProperties(declarations, specificity);
return {
match(element) {
return match(element) ? properties : null;
},
specificity
};
}
}
export function unblockScholar() {
return {type: UNBLOCK_SCHOLAR};
}
export function changeRecaptchaVisibility() {
return {type: CHANGE_RECAPTCHA_VISIBILITY};
}
export function scholarDisconnect() {
return {type: SCHOLAR_DISCONNECT};
}
const firstCategoryRecaptchaQuery = cssSelect.compile('#gs_captcha_c');
const secondCategoryRecaptchaQuery = cssSelect.compile('.g-recaptcha');
const titleQuery = cssSelect.compile('head title');
const publicationsQuery = cssSelect.compile('.gs_r.gs_or.gs_scl .gs_ri');
const titleFromPublicationQuery = cssSelect.compile('.gs_rt a');
const citersLinkFromPublicationQuery = cssSelect.compile('.gs_fl a');
const metadataFromPublicationQuery = cssSelect.compile('.gs_a');
export function resolveHtml(url, text) {
return (dispatch, getState) => {
const dispatchAndEcho = (action, refractoryPeriod) => {
if (action != null) {
const now = Date.now();
dispatch({
...action,
beginOfRefractoryPeriod: now,
endOfRefractoryPeriod: now + refractoryPeriod,
});
module.exports = function matcher(rule, selector) {
const match = CSSselect.compile(selector);
const specificity = calculateSpecificity(selector);
const declarations = rule.nodes.filter(node => node.type === 'decl');
const properties = declarations.map(function(decl) {
const name = decl.prop.trim();
const value = decl.value.trim();
const important = decl.important;
const property = { name, value, important, specificity };
return property;
});
return function(element) {
if (match(element))
return properties;
};
}
public querySelectorAll(selector: string): HTMLElement[] {
if (!CACHED_CSS_SELECTORS.has(selector)) {
CACHED_CSS_SELECTORS.set(selector, cssSelect.compile(selector));
}
const matches: any[] = cssSelect(
CACHED_CSS_SELECTORS.get(selector) as cssSelect.CompiledQuery,
this._document.children
);
const result = matches.map((element) => {
return new HTMLElement(element, this);
});
return result;
}
return function(match, container) {
var testFn;
container = container || this;
if (typeof match === 'string') {
testFn = select.compile(match, container.options);
} else if (typeof match === 'function') {
testFn = function(el, i) {
return match.call(el, i, el);
};
} else if (match.cheerio) {
testFn = match.is.bind(match);
} else {
testFn = function(el) {
return match === el;
};
}
return container._make(filterFn(this, testFn));
};
};
return function(match, container) {
var testFn;
container = container || this;
if (typeof match === 'string') {
testFn = select.compile(match, container.options);
} else if (typeof match === 'function') {
testFn = function(el, i) {
return match.call(el, i, el);
};
} else if (match.cheerio) {
testFn = match.is.bind(match);
} else {
testFn = function(el) {
return match === el;
};
}
return container._make(filterFn(this, testFn));
};
};
export function compile(query) {
return CSSselect.compile(resolveQuery(query), {adapter});
}
export function changeRecaptchaVisibility() {
return {type: CHANGE_RECAPTCHA_VISIBILITY};
}
export function scholarDisconnect() {
return {type: SCHOLAR_DISCONNECT};
}
const firstCategoryRecaptchaQuery = cssSelect.compile('#gs_captcha_c');
const secondCategoryRecaptchaQuery = cssSelect.compile('.g-recaptcha');
const titleQuery = cssSelect.compile('head title');
const publicationsQuery = cssSelect.compile('.gs_r.gs_or.gs_scl .gs_ri');
const titleFromPublicationQuery = cssSelect.compile('.gs_rt a');
const citersLinkFromPublicationQuery = cssSelect.compile('.gs_fl a');
const metadataFromPublicationQuery = cssSelect.compile('.gs_a');
export function resolveHtml(url, text) {
return (dispatch, getState) => {
const dispatchAndEcho = (action, refractoryPeriod) => {
if (action != null) {
const now = Date.now();
dispatch({
...action,
beginOfRefractoryPeriod: now,
endOfRefractoryPeriod: now + refractoryPeriod,
});
}
setTimeout(() => {
dispatch({type: SCHOLAR_REQUEST_REFRACTORY_PERIOD_DONE});
}, refractoryPeriod);
}