-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
playground: image & cache #86
Open
sekedus
wants to merge
4
commits into
duzun:master
Choose a base branch
from
sekedus:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
$url = @$_POST['url'] ?: @$_GET['url']; | ||
$sel = @$_POST['sel'] ?: @$_GET['sel']; | ||
$go = @$_POST['go'] ?: @$_GET['go']; | ||
$ch = @$_POST['ch'] ?: @$_GET['ch']; | ||
$rm = strtoupper(getenv('REQUEST_METHOD') ?: $_SERVER['REQUEST_METHOD']); | ||
// var_export(compact('url', 'sel', 'go')+[$rm]+$_SERVER); | ||
if ( $rm == 'POST' ) { | ||
|
@@ -16,7 +15,7 @@ | |
|
||
// Enable cache | ||
hQuery::$cache_path = sys_get_temp_dir() . '/hQuery/'; | ||
isset($ch) && $ch !== '' and hQuery::$cache_expires = (int)$ch; | ||
$_POST['ch'] === '0' || (int)$_POST['ch'] > 0 and hQuery::$cache_expires = (int)$_POST['ch']; | ||
|
||
// Results acumulator | ||
$return = array(); | ||
|
@@ -157,6 +156,10 @@ | |
padding: 15px 5px 10px; | ||
vertical-align: top; | ||
} | ||
table>tbody>tr>td img{ | ||
max-width: 300px; | ||
height: auto; | ||
} | ||
td pre { | ||
margin: 0; | ||
} | ||
|
@@ -255,7 +258,7 @@ | |
color: #428bca; | ||
background-color: #fff; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you using an EditorConfig plugin in your IDE? |
||
.text-center { | ||
text-align: center; | ||
} | ||
|
@@ -278,7 +281,7 @@ | |
<form name="hquery" action="" method="post"> | ||
<p><label>URL: <input type="url" name="url" value="<?=htmlspecialchars(@$url??'', ENT_QUOTES);?>" placeholder="e.g. https://mariauzun.com/portfolio" autofocus class="form-control" required /></label></p> | ||
<p><label>Selector: <input type="text" name="sel" value="<?=htmlspecialchars(@$sel??'', ENT_QUOTES);?>" placeholder="e.g. 'a[href] > img[src]:parent'" class="form-control" required /></label></p> | ||
<p><label>Cache: <input type="number" name="ch" value="<?=$ch?>" min="0" max="3600" step="1" placeholder="e.g. 600" class="form-control" /> (seconds)</label></p> | ||
<p><label>Cache: <input type="number" name="ch" value="<?=$_POST['ch']==='0'||(int)$_POST['ch']>0?@$_POST['ch']:'';?>" min="0" max="3600" placeholder="e.g. 600" class="form-control" /> (seconds) <code>default: 3600</code></label></p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line repeats the logic for |
||
|
||
<p> | ||
<button type="submit" name="go" value="elements" <?=$go=='elements'?'aria-pressed="true"':''?> class="btn btn-success">Fetch elements</button> | ||
|
@@ -324,7 +327,7 @@ | |
hQuery::$cache_path: <code><?php echo hQuery::$cache_path ?></code> | ||
</li> | ||
<li class="list-group-item"> | ||
hQuery::$cache_expires: <code><?php echo hQuery::$cache_expires ?></code> | ||
hQuery::$cache_expires: <code><?php echo hQuery::$cache_expires ?> s</code> | ||
</li> | ||
<li class="list-group-item"> | ||
Size: <span data-name="doc.size" class="badge"><?=empty($doc)?'':$doc->size;?></span> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$_GET['ch']
allow to save the state in the URL and preserve it during refreshes. Maybe not a big deal for the cache expires, but I'd prefer to have consistency over all variables.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eg.
http://localhost:8074/playground.php?url=http://duzun.me&sel=a%20img:parent&ch=10
.