Optimalization: simplified selectors
Squash
This commit is contained in:
parent
dd8ab7c001
commit
01c54d4d83
16 changed files with 34 additions and 24 deletions
|
@ -83,8 +83,8 @@ $(function()
|
|||
}
|
||||
}
|
||||
|
||||
$('form[data-confirm-text]').submit(confirmEvent);
|
||||
$('a[data-confirm-text]').click(confirmEvent);
|
||||
$('form.confirmable').submit(confirmEvent);
|
||||
$('a.confirmable').click(confirmEvent);
|
||||
|
||||
|
||||
//simple action buttons
|
||||
|
@ -123,7 +123,7 @@ $(function()
|
|||
|
||||
|
||||
//attach data from submit buttons to forms before .submit() gets called
|
||||
$(':submit').each(function()
|
||||
$('.submit').each(function()
|
||||
{
|
||||
$(this).click(function()
|
||||
{
|
||||
|
|
|
@ -511,7 +511,7 @@ class PostController
|
|||
throw new SimpleException('Thumbnail file is not readable');
|
||||
|
||||
$this->context->layoutName = 'layout-file';
|
||||
$this->context->transport->cacheDaysToLive = 30;
|
||||
$this->context->transport->cacheDaysToLive = 365;
|
||||
$this->context->transport->mimeType = 'image/jpeg';
|
||||
$this->context->transport->fileHash = 'thumb' . md5($name . filemtime($path));
|
||||
$this->context->transport->filePath = $path;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div>
|
||||
<label class="left"> </label>
|
||||
<div class="input-wrapper">
|
||||
<button type="submit">Log in</button>
|
||||
<button class="submit" type="submit">Log in</button>
|
||||
|
||||
<input type="hidden" name="remember" value="0"/>
|
||||
<label>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<?php if (PrivilegesHelper::confirm(Privilege::DeleteComment, PrivilegesHelper::getIdentitySubPrivilege($this->context->comment->commenter))): ?>
|
||||
<span class="delete">
|
||||
<a class="simple-action" href="<?php echo \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" data-confirm-text="Are you sure you want to delete this comment?">
|
||||
<a class="simple-action confirmable" href="<?php echo \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" data-confirm-text="Are you sure you want to delete this comment?">
|
||||
delete
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
@ -62,6 +62,6 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Submit</button>
|
||||
<button class="submit" type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<div id="url-handler">
|
||||
<div class="input-wrapper"><textarea placeholder="Paste some URLs here, one per line." name="urls"></textarea></div>
|
||||
</div>
|
||||
<button type="submit">Add</button>
|
||||
<button class="submit" type="submit">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
|||
</div>
|
||||
|
||||
<div class="submit-wrapper">
|
||||
<button id="the-submit" type="submit">Submit</button>
|
||||
<button id="the-submit" class="submit" type="submit">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -341,8 +341,8 @@
|
|||
<input type="hidden" name="submit" value="1"/>
|
||||
|
||||
<div>
|
||||
<button name="sender" type="submit" value="preview">Preview</button>
|
||||
<button name="sender" type="submit" value="submit">Submit</button>
|
||||
<button name="sender" class="submit" type="submit" value="preview">Preview</button>
|
||||
<button name="sender" class="submit" type="submit" value="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<?php foreach ($this->context->options as $option): ?>
|
||||
<li class="<?php echo $option['class']; if (isset($option['inactive'])) echo ' inactive' ?>">
|
||||
<?php
|
||||
$class = [];
|
||||
|
||||
$attrs = [];
|
||||
if (!empty($option['link']))
|
||||
{
|
||||
|
@ -14,14 +16,22 @@
|
|||
elseif (!empty($option['simple-action']))
|
||||
{
|
||||
$attrs['href'] = $option['simple-action'];
|
||||
$attrs['class'] = 'simple-action';
|
||||
$class []= 'simple-action';
|
||||
|
||||
if (isset($option['data-confirm-text']))
|
||||
{
|
||||
$attrs['data-confirm-text'] = $option['data-confirm-text'];
|
||||
$class []= 'confirmable';
|
||||
}
|
||||
|
||||
if (isset($option['data-redirect-url']))
|
||||
$attrs['data-redirect-url'] = $option['data-redirect-url'];
|
||||
}
|
||||
else
|
||||
$attrs['href'] = '#';
|
||||
|
||||
foreach ($option as $key => $val)
|
||||
if (strpos($key, 'data-') === 0)
|
||||
$attrs[$key] = $val;
|
||||
if (!empty($class))
|
||||
$attrs['class'] = join(' ', $class);
|
||||
|
||||
TextHelper::openHtmlTag('a', $attrs);
|
||||
echo $option['text'];
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Tag!</button>
|
||||
<button class="submit" type="submit">Tag!</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Merge!</button>
|
||||
<button class="submit" type="submit">Merge!</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Rename!</button>
|
||||
<button class="submit" type="submit">Rename!</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form action="<?php echo \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>" method="post" class="delete aligned" autocomplete="off" data-confirm-text="Are you sure you want to delete your account?">
|
||||
<form action="<?php echo \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>" method="post" class="delete aligned confirmable" autocomplete="off" data-confirm-text="Are you sure you want to delete your account?">
|
||||
<?php if ($this->context->user->id == $this->context->transport->user->id): ?>
|
||||
<div class="current-password">
|
||||
<label class="left" for="current-password">Current password:</label>
|
||||
|
@ -12,6 +12,6 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Delete account</button>
|
||||
<button class="submit" type="submit">Delete account</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -56,6 +56,6 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Submit</button>
|
||||
<button class="submit" type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
<div>
|
||||
<label class="left"></label>
|
||||
<button type="submit">Register</button>
|
||||
<button class="submit" type="submit">Register</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Continue</button>
|
||||
<button class="submit" type="submit">Continue</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Update settings</button>
|
||||
<button class="submit" type="submit">Update settings</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in a new issue