Skip to content

Commit

Permalink
Disable/Enable Javascript. Allow to prompt for permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
StringManolo committed Jul 17, 2024
1 parent 02bfe45 commit 189dc19
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 1 deletion.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Panther/app/build/dexedClasses/classes.dex
Binary file not shown.
Binary file modified Panther/app/build/output/app-debug.apk
Binary file not shown.
Binary file modified Panther/app/build/output/app-unsigned-debug.apk
Binary file not shown.
Binary file modified Panther/app/build/resources.ap_
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import android.os.Environment;
import android.webkit.DownloadListener;
import android.webkit.URLUtil;
import android.webkit.PermissionRequest;

public class MainActivity extends Activity {
Intent intentArchivos = null;
Expand Down Expand Up @@ -68,6 +69,7 @@ public class MainActivity extends Activity {
/* String SSE = "https://google.com/search?q="; */
String SSE = "https://html.duckduckgo.com/html/?q=";
int progress = 0;
boolean jsEnabled = true;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -123,6 +125,17 @@ public void onItemClick(AdapterView < ? > adapterView, View view, int position,
executeButton.setVisibility(View.VISIBLE);
}
}

if (value.equals("Javascript")) {
if (jsEnabled) {
jsEnabled = false;
Toast.makeText(getApplicationContext(), "Javascript is now disabled", Toast.LENGTH_SHORT).show();
} else {
jsEnabled = true;
Toast.makeText(getApplicationContext(), "Javascript is now enabled", Toast.LENGTH_SHORT).show();
}
Panther.getSettings().setJavaScriptEnabled(jsEnabled);
}

if (value.equals("Exit")) {
Panther.clearCache(true);
Expand Down Expand Up @@ -173,13 +186,40 @@ public void onItemClick(AdapterView < ? > adapterView, View view, int position,


Panther.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});

Panther.setWebChromeClient(new WebChromeClient() {
Panther.setWebChromeClient(new WebChromeClient() {
@Override
public void onPermissionRequest(final PermissionRequest request) {
final String[] requestedPermissions = request.getResources();

new AlertDialog.Builder(MainActivity.this)
.setTitle("Permission Request")
.setMessage("The website is requesting permission to access device resources.")
.setPositiveButton("Allow", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
request.grant(requestedPermissions);
}
})
.setNegativeButton("Deny", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
request.deny();
}
})
.show();
}

@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
String message = consoleMessage.message() + " -- From line " +
Expand Down
1 change: 1 addition & 0 deletions Panther/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<string-array name="array_technology">
<item>Console</item>
<item>Javascript</item>
<item>Search Engine</item>
<item>Source Code</item>
<!--
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Panther is a privacy-focused Android browser based on WebView.
- Change Search Engine
<br>

- Disable/Enable Javascript
<br>

- Allows Zoom In/Out even when webpages try to disable it
<br>

Expand Down

0 comments on commit 189dc19

Please sign in to comment.