Skip to content

Commit

Permalink
last version
Browse files Browse the repository at this point in the history
  • Loading branch information
giangmd committed Nov 21, 2015
1 parent d1ef236 commit 50904ee
Show file tree
Hide file tree
Showing 21 changed files with 205 additions and 9,497 deletions.
10 changes: 10 additions & 0 deletions css/font.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Style for GP Back To Top
*/
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: local('☺'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../glyphicons-halflings-regular.svg') format('svg');
font-weight: normal;
font-style: normal;
}
66 changes: 36 additions & 30 deletions css/gp-bttp.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
/*
* Style GP Back To Top Plugin
*
* @author Giang Peter
*/
.gp-back-to-top {
display: none;
width: 30px;
height: 30px;
border-radius: 50%;
padding: 5px;
background-color: #111f1c;
color: #ffffff;
text-align: center;
position: fixed;
z-index: 99999;
bottom: 45px;
right: 20px;
font-size: 14px;
cursor: pointer;
}
.gp-back-to-top span {
position: absolute;
top: 24%;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
}
@import url("font.css");

.gp-back-to-top {
display: none;
width: 35px;
height: 35px;
border-radius: 50%;
padding: 5px;
background-color: #111f1c;
color: #ffffff;
text-align: center;
position: fixed;
bottom: 45px;
right: 25px;
font-size: 20px;
cursor: pointer;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.gp-back-to-top span {
position: absolute;
top:24%;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
font-family: 'Glyphicons Halflings';
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gp-back-to-top span:before {
content: "\e113";
}
117 changes: 108 additions & 9 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,27 +1,118 @@
/*
Style for GP Back To Top
*/
@import url("font.css");

.gpbttb-form {
width: 360px;
width: 320px;
margin: 20px 0;
padding-top: 15px;
padding: 15px;
border: 1px solid #cdcdcd;
overflow: hidden;
}

.gpbttb-form .form-group {
width: 100%;
float: left;
clear: both;
margin-bottom: 10px;
}

.gpbttb-form label {
width: 47.999997%;
float: left;
padding: 5px 5px 0 5px;
font-size: 16px;
font-weight: 700;
box-sizing: border-box;
}

.gpbttb-form input {
width: 47.999997%;
float: left;
padding: 5px;
font-size: 16px;
border-radius: 3px;
border: 1px solid #eee;
box-sizing: border-box;
}

.gpbttb-form input:focus {
border: 1px solid #337AB7;
box-shadow: 1px #00a0d2;
}

.gpbttb-form input[type="color"] {
padding: 2px 5px;
height: 30px;
}

.gpbttb-form input[type="submit"] {
background-color: #337AB7;
margin-left: 47.999997%;
border-radius: 3px;
color: #fff;
text-transform: uppercase;
cursor: pointer;
}

.gpbttb-form input[type="submit"]:focus,
.gpbttb-form input[type="submit"]:hover {
box-shadow: 1px #00a0d2;
}

.gp-back-to-top {
display: block !important;
width: 30px;
height: 30px;
width: 35px;
height: 35px;
border-radius: 50%;
padding: 5px;
background-color: #111f1c;
color: #ffffff;
text-align: center;
position: fixed;
bottom: 45px;
right: 20px;
font-size: 20px;
}
.gp-back-to-top span {
position: absolute;
top:24%;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
font-family: 'Glyphicons Halflings';
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gp-back-to-top span:before {
content: "\e113";
}

/* Style for FO */
/*------------------------------------/
@import url("font.css");
.gp-back-to-top {
display: none;
width: 35px;
height: 35px;
border-radius: 50%;
padding: 5px;
background-color: #111f1c;
color: #ffffff;
text-align: center;
position: relative !important;
bottom: inherit !important;
right: inherit !important;
font-size: 14px;
position: fixed;
bottom: 45px;
right: 25px;
font-size: 20px;
cursor: pointer;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.gp-back-to-top span {
position: absolute;
Expand All @@ -31,4 +122,12 @@ Style for GP Back To Top
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
}
font-family: 'Glyphicons Halflings';
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gp-back-to-top span:before {
content: "\e113";
}
------------------------------------------------*/
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
82 changes: 37 additions & 45 deletions gp-back-to-top.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function __construct()
{
$this->fr_file = 'gp-bttp';
$this->ad_file = 'gp-admin';
$this->d_w = 30;
$this->d_h = 30;
$this->d_fz = 14;
$this->d_w = 35;
$this->d_h = 35;
$this->d_fz = 20;
$this->d_bgr = '#111f1c';
$this->d_cl = '#ffffff';
$this->d_pd = 5;
Expand All @@ -48,7 +48,6 @@ public function gp_create_menu() {
}

public function gp_bttb_enqueue_admin_scripts() {
wp_enqueue_style( 'gp_bttb_admin_bootstrap', plugins_url( '/lib/bootstrap-3.3.4/css/bootstrap.min.css', __FILE__ ), array(), '3.3.4' );
wp_enqueue_style( 'gp_bttb_admin_style', plugins_url( '/css/style.css', __FILE__ ), array(), self::VERSION );

$ad_file_p = dirname(__FILE__) . '/css/'.$this->ad_file.'.css';
Expand All @@ -62,8 +61,6 @@ public function gp_bttb_enqueue_admin_scripts() {
}

public function gp_bttp_enqueue_scripts() {
wp_register_style( 'gp_bttb_fo_bootstrap', plugins_url( '/lib/bootstrap-3.3.4/css/bootstrap.min.css', __FILE__ ), array(), '3.3.4' );
wp_enqueue_style( 'gp_bttb_fo_bootstrap' );
wp_register_style( 'gp-bttp-style', plugins_url( '/css/'.$this->fr_file.'.css', __FILE__ ), array(), self::VERSION );
wp_enqueue_style( 'gp-bttp-style' );

Expand All @@ -78,59 +75,41 @@ public function gp_create_options() {
?>
<div class="wrap">
<h2>GP Back To Top Plugin</h2>
<form action="" method="POST" class="form-horizontal gpbttb-form">
<form action="" method="POST" class="gpbttb-form">
<div class="form-group">
<label for="width" class="col-sm-5 control-label">Width: </label>
<div class="col-sm-5">
<input type="number" min="1" max="100" name="width" id="width" class="form-control" value="<?php echo $this->d_w; ?>">
</div>
<label for="width">Width: </label>
<input type="number" min="1" max="100" name="width" id="width" value="<?php echo $this->d_w; ?>">
</div>
<div class="form-group">
<label for="height" class="col-sm-5 control-label">Height: </label>
<div class="col-sm-5">
<input type="number" min="1" max="100" name="height" id="height" class="form-control" value="<?php echo $this->d_h; ?>">
</div>
<label for="height">Height: </label>
<input type="number" min="1" max="100" name="height" id="height" value="<?php echo $this->d_h; ?>">
</div>
<div class="form-group">
<label for="font" class="col-sm-5 control-label">Font-size: </label>
<div class="col-sm-5">
<input type="number" min="1" max="100" name="font" id="font" class="form-control" value="<?php echo $this->d_fz; ?>">
</div>
<label for="font">Font-size: </label>
<input type="number" min="1" max="100" name="font" id="font" value="<?php echo $this->d_fz; ?>">
</div>
<div class="form-group">
<label for="bg_color" class="col-sm-5 control-label">Background color: </label>
<div class="col-sm-5">
<input type="color" name="bg_color" id="bg_color" class="form-control" value="<?php echo $this->d_bgr; ?>">
</div>
<label for="bg_color">Background color: </label>
<input type="color" name="bg_color" id="bg_color" value="<?php echo $this->d_bgr; ?>">
</div>
<div class="form-group">
<label for="color" class="col-sm-5 control-label">Color: </label>
<div class="col-sm-5">
<input type="color" name="color" id="color" class="form-control" value="<?php echo $this->d_cl; ?>">
</div>
<label for="color">Color: </label>
<input type="color" name="color" id="color" value="<?php echo $this->d_cl; ?>">
</div>
<div class="form-group">
<label for="bottom" class="col-sm-5 control-label">Bottom: </label>
<div class="col-sm-5">
<input type="number" min="1" max="100" name="bottom" id="bottom" class="form-control" value="<?php echo $this->d_bt; ?>">
</div>
<label for="bottom">Bottom: </label>
<input type="number" min="1" max="100" name="bottom" id="bottom" value="<?php echo $this->d_bt; ?>">
</div>
<div class="form-group">
<label for="right" class="col-sm-5 control-label">Right: </label>
<div class="col-sm-5">
<input type="number" min="1" max="100" name="right" id="right" class="form-control" value="<?php echo $this->d_rt; ?>">
</div>
<label for="right">Right: </label>
<input type="number" min="1" max="100" name="right" id="right" value="<?php echo $this->d_rt; ?>">
</div>
<div class="form-group">
<div class="col-sm-5 col-sm-offset-5">
<input type="submit" name="gp_bttb_up" value="Submit" class="form-control btn btn-primary">
</div>
<input type="submit" name="gp_bttb_up" value="Submit">
</div>
</form>
<p>
<div class="gp-back-to-top" id="gpToTop">
<span class="glyphicon glyphicon-chevron-up"></span>
</div>
<div class="gp-back-to-top" id="gpToTop"><span></span></div>
</p>
<script type="text/javascript">
(function ($) {
Expand All @@ -157,8 +136,8 @@ function hex(x) {
right = $('.gpbttb-form').find('#right');

function updateStyle() {
width.val(demo.outerWidth());
height.val(demo.outerHeight());
width.val( demo.css('width').replace("px", '') );
height.val( demo.css('height').replace("px", '') );
font.val( demo.css('font-size').replace("px", '') );
bg_color.val( rgb2hex(demo.css('background-color')) );
color.val( rgb2hex(demo.css('color')) );
Expand All @@ -185,6 +164,7 @@ function updateStyle() {
*
* @author Giang Peter
*/
@import url(\"font.css\");
.gp-back-to-top {
display: none;
width: ".$width."px;
Expand All @@ -200,6 +180,9 @@ function updateStyle() {
right: ".$right."px;
font-size: ".$font."px;
cursor: pointer;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.gp-back-to-top span {
position: absolute;
Expand All @@ -209,13 +192,22 @@ function updateStyle() {
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
font-family: 'Glyphicons Halflings';
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gp-back-to-top span:before {
content: '\\e113';
}";

$file = fopen( dirname(__FILE__) . '\css\/'.$this->fr_file.'.css', 'w') or die('File not found.');
$file_fo = dirname(__FILE__) . '/css/'.$this->fr_file.'.css';
$file = fopen($file_fo, 'w') or die('File not found.');
fwrite($file, $txt);
fclose($file);

$file_ad = fopen( dirname(__FILE__) . '\css\/'.$this->ad_file.'.css', 'w') or die('File not found.');
$file_bo = dirname(__FILE__) . '/css/'.$this->ad_file.'.css';
$file_ad = fopen($file_bo, 'w') or die('File not found.');
fwrite($file_ad, $txt);
fclose($file_ad);
?>
Expand Down
2 changes: 1 addition & 1 deletion js/gp-bttp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

(function ($) {
$(document).ready(function() {
var element = '<div class="gp-back-to-top" id="gpToTop"><span class="glyphicon glyphicon-chevron-up"></span></div>';
var element = '<div class="gp-back-to-top" id="gpToTop"><span></span></div>';
$('body').append(element);

var toTop = $('#gpToTop');
Expand Down
Loading

0 comments on commit 50904ee

Please sign in to comment.