Update equation builder
This commit is contained in:
75
assets/css/equation.css
Normal file
75
assets/css/equation.css
Normal file
@@ -0,0 +1,75 @@
|
||||
.sp-equation-builder .button {
|
||||
margin: 2px;
|
||||
padding: 0 10px 1px;
|
||||
}
|
||||
|
||||
.sp-equation {
|
||||
background: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
transition: .05s border-color ease-in-out;
|
||||
margin-top: 6px;
|
||||
padding: 23px;
|
||||
}
|
||||
|
||||
.sp-equation:hover,
|
||||
.sp-equation.ui-state-active {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.sp-equation.ui-state-hover {
|
||||
border-color: #5b9dd9;
|
||||
-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
||||
box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
||||
}
|
||||
|
||||
.sp-equation-variable {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.sp-equation-formula .ui-sortable-placeholder {
|
||||
visibility: visible !important;
|
||||
margin: 2px;
|
||||
padding: 1 10px 1px;
|
||||
border: 1px dashed #bbb;
|
||||
background: transparent;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.sp-equation-formula .button {
|
||||
position: relative;
|
||||
margin: 2px 4px;
|
||||
}
|
||||
|
||||
.sp-equation-formula .button .remove {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
left: -8px;
|
||||
border: 1px solid #ccc;
|
||||
background: #f7f7f7;
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sp-equation-formula .button:hover .remove {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sp-equation-formula .button.ui-sortable-helper .remove,
|
||||
.sp-equation-formula .button.ui-sortable-helper:hover .remove {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sp-equation-formula .button .remove:hover {
|
||||
background: #e0e0e0;
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
/* SportsPress */
|
||||
|
||||
.sp-scrollable-table-wrapper {
|
||||
overflow: auto;
|
||||
/* Header */
|
||||
.sp-header {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* Data Tables */
|
||||
.sp-scrollable-table-wrapper {
|
||||
overflow: auto;
|
||||
}
|
||||
.sp-data-table {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
37
assets/js/admin/equationbuilder.js
Normal file
37
assets/js/admin/equationbuilder.js
Normal file
@@ -0,0 +1,37 @@
|
||||
jQuery(document).ready(function($){
|
||||
$("#title").keyup(function() {
|
||||
val = $(this).val();
|
||||
if ( val == '' ) val = 'f(x)';
|
||||
$(".sp-equation-variable").text( val + ' =' );
|
||||
});
|
||||
|
||||
$(".sp-equation-parts .button").draggable({
|
||||
appendTo: "body",
|
||||
helper: "clone",
|
||||
cursor: "move",
|
||||
distance: 10,
|
||||
containment: "#sp_equationdiv",
|
||||
}).click(function() {
|
||||
$("<label class='button'></label>").text( $(this).text() ).append("<span class='remove'>×</span><input name='sp_equation[]' type='hidden' value='" + $(this).data("variable") + "'>").appendTo( $(".sp-equation-formula") );
|
||||
});
|
||||
|
||||
$(".sp-equation").droppable({
|
||||
activeClass: "ui-state-active",
|
||||
hoverClass: "ui-state-hover",
|
||||
accept: ".button:not(.ui-sortable-helper)",
|
||||
drop: function( event, ui ) {
|
||||
$("<label class='button'></label>").text( ui.draggable.text() ).append("<span class='remove'>×</span><input name='sp_equation[]' type='hidden' value='" + ui.draggable.data("variable") + "'>").appendTo( $(".sp-equation-formula") );
|
||||
}
|
||||
}).sortable({
|
||||
items: ".button",
|
||||
tolerance: "pointer",
|
||||
containment: "#sp_equationdiv",
|
||||
sort: function() {
|
||||
$( this ).removeClass( "ui-state-active" );
|
||||
}
|
||||
});
|
||||
|
||||
$(".sp-equation-formula").on("click", ".button .remove", function() {
|
||||
$(this).closest(".button").remove();
|
||||
});
|
||||
});
|
||||
@@ -11,6 +11,9 @@ function viewport() {
|
||||
|
||||
var sp_responsive_activated = false;
|
||||
|
||||
/* Header */
|
||||
$('body').prepend( '<div class="sp-header"></div>' );
|
||||
|
||||
/* Countdown */
|
||||
$("[data-countdown]").each(function() {
|
||||
var $this = $(this), finalDate = $(this).data('countdown');
|
||||
|
||||
Reference in New Issue
Block a user