WebBrowser/Tools/Scripts.py

branch
QtWebEngine
changeset 4758
c973eef8fef1
parent 4749
750577d35452
child 4766
5f8d08aa2217
equal deleted inserted replaced
4754:1ff6d0ecb2fd 4758:c973eef8fef1
349 }})()""" 349 }})()"""
350 350
351 data = bytes(data).decode("utf-8") 351 data = bytes(data).decode("utf-8")
352 data = data.replace("'", "\\'") 352 data = data.replace("'", "\\'")
353 return source.format(data) 353 return source.format(data)
354
355 ###########################################################################
356 ## scripts below are specific for eric
357 ###########################################################################
358
359
360 def getFeedLinks():
361 """
362 Function generating a script to extract all RSS and Atom feed links.
363
364 @return script to extract all RSS and Atom feed links
365 @rtype str
366 """
367 source = """
368 (function() {
369 var out = [];
370 var links = document.getElementsByTagName('link');
371 for (var i = 0; i < links.length; ++i) {
372 var e = links[i];
373 if ((e.rel == 'alternate') &&
374 ((e.type == 'application/atom+xml') ||
375 (e.type == 'application/rss+xml')
376 )
377 ) {
378 out.push({
379 url: e.getAttribute('href'),
380 title: e.getAttribute('title')
381 });
382 }
383 }
384 return out;
385 })()"""
386 return source

eric ide

mercurial