• Anxietier

    @mikael
    sorry for reply late, im not sure if i get your point at sec paragraph, cause my eng not even good and machine translation not so reliable.
    let me assume you meant that you would give support if i want to try adding read-mode.
    thanks for your kind, but i dont know if i have time to do it, and i didnt learn objc before, so maybe it would take long time to finish that (or never :/
    btw, content rule is a great direction indeed, i should take some time to learn about that

    posted in Pythonista read more
  • Anxietier

    @mikael
    well, theres an open source android app names 'H-viewer', using regex&selector to select out imgs, and re-layout them, so that we can just watch imgs. also, theres an app in appstore names 'yealico', it has similar function.
    I was trying to fake(reproduce?) that by python in ista, I found one way to do that, 'use two wkwebviews, only present one, the other one load url in background, when it did finish load, use js selector to get imgs url, then show imgs on presented webview', im not sure will background-webview cost data-usage, but I dont want to cost double 'img data-usage'

    posted in Pythonista read more
  • Anxietier

    @mikael
    thanks, it is helpful, i would try to understand them.

    posted in Pythonista read more
  • Anxietier

    @JonB
    yeah i need js in script tag to run. some requests is not easy to fake them you know, so i was wandering if i can let webview run in 'read mode' to simulate 'selenium', cause some imgs spend many data traffic, and i dont wanna take double traffic for one img

    posted in Pythonista read more
  • Anxietier

    hi, im back again :D
    we know that some browser has non-pic mode (i dont know right name,just like that mean), is it possible to add that feature to wkwebview? for some reason, i just need the full html content (dom-tree maybe?)

    posted in Pythonista read more
  • Anxietier

    @mikael
    oh I see, I usually use r_string in py, so I didn't notice \' in doc_string
    now it works fine
    thanks for help

    posted in Pythonista read more
  • Anxietier

    @mikael
    I’m not sure if I described my issue clearly, and here’s my another test code, perhaps that would be clearly

    file_name = 'test.copy(2).html'
    file_abs_path = os.path.abspath(file_name)
    url_file_name = 'file://' + file_name
    url_file_abs_path = 'file://' + file_abs_path
    
    with open(file_name, 'r', encoding='utf8') as f:
        html = ''.join(f.readlines())
    
    v = MagicWebView()
    v.present()
    
    # v.load_html(html) # can load but button doesn't work
    
    # v.load_url(file_name, no_cache=False, timeout=5) # can load but button doesn't work
    
    # v.load_url(file_abs_path, no_cache=False, timeout=5) # can load but button doesn't work
    
    # v.load_url(url_file_name, no_cache=False, timeout=5) # would let ista crash or load faild
    
    # v.load_url(url_file_abs_path, no_cache=False, timeout=5) # doesn't load
    
    v.clear_cache() 
    

    posted in Pythonista read more
  • Anxietier

    @cvp
    thanks, but it seems doesn’t work, here’s my test code

    file_name = 'test.copy(2).html'
    file_abs_path = os.path.abspath(file_name)
    url_file_name = 'file://' + file_name
    url_file_abs_path = 'file://' + file_abs_path
    
    with open(file_name, 'r', encoding='utf8') as f:
        html = ''.join(f.readlines())
    
    v = MagicWebView()
    v.present()
    
    # v.load_html(html) # can load but button doesn't work
    
    # v.load_url(file_name, no_cache=False, timeout=5) # can load but button doesn't work
    
    # v.load_url(file_abs_path, no_cache=False, timeout=5) # can load but button doesn't work
    
    # v.load_url(url_file_name, no_cache=False, timeout=5) # would let ista crash or load faild
    
    # v.load_url(url_file_abs_path, no_cache=False, timeout=5) # doesn't load
    
    v.clear_cache() 
    

    posted in Pythonista read more
  • Anxietier

    Hi, I tested one demo code in readme of pythonista-wkwebview

    class MagicWebView(WKWebView):
      
      def on_magic(self, message):
        print('WKWebView magic ' + message)
        
    html = '''
    <body>
    <button onclick="window.webkit.messageHandlers.magic.postMessage(\'spell\')">
    Cast a spell
    </button>
    </body>
    '''
    
    v = MagicWebView()
    v.load_html(html)
    

    Well it works good, but when I try to load html file, the 'on_magic' doesn't work, here's my code in py file

    class MagicWebView(WKWebView):
        def on_magic(self, message):
            print('WKWebView magic ' + message)
    
    v = MagicWebView()
    v.present()
    # v.load_html(html)
    v.load_url('test.html', no_cache=False, timeout=5)
    v.clear_cache()
    

    I don't know how to fix it

    posted in Pythonista read more
  • Anxietier

    hi, i found another bug, after i use 5 fingers to switch app and get back, multi-touch would be not working

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!