mirror of
https://github.com/taroved/pol
synced 2025-05-16 06:10:09 -07:00
html generation fixed; setup tool buttons in progress
This commit is contained in:
parent
665cdc5d76
commit
f6cb283599
@ -58,7 +58,7 @@ def setBaseAndRemoveScriptsAndMore(response, url):
|
||||
if attr.startswith('on'):
|
||||
del bad.attrib[attr]
|
||||
|
||||
return etree.tostring(tree, pretty_print=True)
|
||||
return etree.tostring(tree, method='html')
|
||||
|
||||
def buildScrapyResponse(page_factory, body):
|
||||
status = int(page_factory.status)
|
||||
|
46
frontend/frontend/static/frontend/assets/js/setup-tool.js
Normal file
46
frontend/frontend/static/frontend/assets/js/setup-tool.js
Normal file
@ -0,0 +1,46 @@
|
||||
(function(){
|
||||
|
||||
var BG_DATA_KEY = 'st-origin-background';
|
||||
|
||||
function styleHoverElement(element) {
|
||||
$(element).data(BG_DATA_KEY, $(element).css('background'));
|
||||
$(element).css({'background': 'yellow'});
|
||||
}
|
||||
|
||||
function unstyleHoverElement(element) {
|
||||
$(element).css({'background': $(element).data(BG_DATA_KEY)});
|
||||
}
|
||||
|
||||
var previous_hover_element = null;
|
||||
|
||||
function onIframeElementHover(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
if ($(this).prop("tagName")) // is not document object
|
||||
if (event.type == 'mouseenter') {
|
||||
styleHoverElement(this);
|
||||
if (previous_hover_element)
|
||||
unstyleHoverElement(previous_hover_element);
|
||||
previous_hover_element = this;
|
||||
}
|
||||
else {
|
||||
unstyleHoverElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
function onItemButtonClick(event) {
|
||||
if ($(this).hasClass('disabled')) { // start picking
|
||||
$(this).removeClass('disabled');
|
||||
$('iframe').contents().on('mouseenter mouseleave', '*', onIframeElementHover);
|
||||
}
|
||||
else { // stop picking
|
||||
$(this).addClass('disabled');
|
||||
$('iframe').contents().off('mouseenter mouseleave', '*', onIframeElementHover);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).on('click', '#st-title', onItemButtonClick);
|
||||
});
|
||||
|
||||
})();
|
Loading…
x
Reference in New Issue
Block a user