Example usage for android.webkit WebView loadUrl

List of usage examples for android.webkit WebView loadUrl

Introduction

In this page you can find the example usage for android.webkit WebView loadUrl.

Prototype

public void loadUrl(String url) 

Source Link

Document

Loads the given URL.

Usage

From source file:Main.java

public static void updateNums(WebView view) {
    view.loadUrl(
            "javascript:(function()%7Bandroid.getNums(document.querySelector(%22%23notifications_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23messages_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23requests_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML)%7D)()");
}

From source file:Main.java

public static void updateNums(WebView view) {
    view.loadUrl(
            "javascript:(function()%7Bandroid.getNums(document.querySelector(%22%23notifications_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23messages_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23requests_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML)%7D).innerHTML%2Cdocument.querySelector(%22%23feed_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML)%7D)()");
}

From source file:Main.java

static void updateNumsService(WebView view) {
    view.loadUrl(
            "javascript:(function()%7Bfunction%20n_s()%7Bandroid.getNums(document.querySelector(%22%23notifications_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23messages_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23requests_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML)%2CsetTimeout(n_s%2C"
                    + BADGE_UPDATE_INTERVAL + ")%7Dtry%7Bn_s()%7Dcatch(_)%7B%7D%7D)()");
}

From source file:Main.java

public static void updateNumsService(WebView view) {
    view.loadUrl(
            "javascript:(function()%7Bfunction%20n_s()%7Bandroid.getNums(document.querySelector(%22%23notifications_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23messages_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23requests_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23feed_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML)%2CsetTimeout(n_s%2C"
                    + BADGE_UPDATE_INTERVAL + ")%7Dtry%7Bn_s()%7Dcatch(_)%7B%7D%7D)()");
}

From source file:Main.java

public static void hideTopBar(WebView wv) {
    wv.loadUrl("javascript: ( function() {" + "    if(document.getElementById('main_nav')) {"
            + "        document.getElementById('main_nav').parentNode.removeChild("
            + "        document.getElementById('main_nav'));"
            + "    } else if (document.getElementById('main-nav')) {"
            + "        document.getElementById('main-nav').parentNode.removeChild("
            + "        document.getElementById('main-nav'));" + "    }" + "})();");
}

From source file:Main.java

public static void getNotificationCount(WebView wv) {
    wv.loadUrl("javascript: ( function() {" + "    if (document.getElementById('notification')) {"
            + "       var count = document.getElementById('notification').innerHTML;"
            + "       NotificationCounter.setNotificationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));"
            + "    } else {" + "       NotificationCounter.setNotificationCount('0');" + "    }"
            + "    if (document.getElementById('conversation')) {"
            + "       var count = document.getElementById('conversation').innerHTML;"
            + "       NotificationCounter.setConversationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));"
            + "    } else {" + "       NotificationCounter.setConversationCount('0');" + "    }" + "})();");
}

From source file:Main.java

public static void call(WebView webview, String function, JSONObject json) {
    webview.loadUrl("javascript:" + function + "('" + json.toString() + "')");
}

From source file:Main.java

static void updateCurrentTab(WebView view) {
    // Get the currently open tab and check on the navigation menu
    view.loadUrl(
            "javascript:(function()%7Btry%7Bvar%20jewel%3Ddocument.querySelector(%22.popoverOpen%22).id%3B%22feed_jewel%22%3D%3Djewel%3Fdocument.querySelector('a%5Bhref*%3D%22%2Fhome.php%3Fsk%3Dh_nor%22%5D')%3Fandroid.getCurrent(%22most_recent%22)%3Aandroid.getCurrent(%22top_stories%22)%3Aandroid.getCurrent(jewel)%7Dcatch(_)%7Bandroid.getCurrent(%22null%22)%7D%7D)()");
}

From source file:Main.java

static void loadCSS(WebView view, String css) {
    // Inject CSS string to the HEAD of the webpage
    view.loadUrl(
            "javascript:(function()%7Bvar%20styles%3Ddocument.createElement('style')%3Bstyles.innerHTML%3D'"
                    + css/*from   w  w  w  . j a va2s.  c o  m*/
                    + "'%2Cstyles.onload%3Dandroid.loadingCompleted()%2Cdocument.getElementsByTagName('head')%5B0%5D.appendChild(styles)%7D)()");
}

From source file:com.github.dfa.diaspora_android.util.Helpers.java

public static void applyDiasporaMobileSiteChanges(final WebView wv) {
    wv.loadUrl("javascript: ( function() {" + "    document.documentElement.style.paddingBottom = '260px';"
            + "    document.getElementById('main').style.paddingTop = '5px';"
            + "    if(document.getElementById('main_nav')) {"
            + "        document.getElementById('main_nav').parentNode.removeChild("
            + "        document.getElementById('main_nav'));"
            + "    } else if (document.getElementById('main-nav')) {"
            + "        document.getElementById('main-nav').parentNode.removeChild("
            + "        document.getElementById('main-nav'));" + "    }" + "})();");
}