Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Basic functionality - ref #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pontikis committed Oct 7, 2012
1 parent 1ee9abb commit 73945fa
Show file tree
Hide file tree
Showing 25 changed files with 937 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
# JetBrains phpStorm IDE files -------------------------------------------------
/.idea/*
# ------------------------------------------------------------------------------
20 changes: 20 additions & 0 deletions MIT_LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2012 Christos Pontikis, http://pontikis.net

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 12 additions & 0 deletions demo/index.css
@@ -0,0 +1,12 @@
#demo_pag1, #demo_pag2 {
padding: 20px;
border: 1px coral solid;
}

#demo_pag1 {
width: 400px;
}

#demo_pag2 {
width: 600px;
}
46 changes: 46 additions & 0 deletions demo/index.html
@@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<head>
<title>jui_pagination demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


<link rel="stylesheet"
href="../lib/jquery-ui-1.8.24.custom/css/ui-lightness/jquery-ui-1.8.24.custom.css">

<link rel="stylesheet" href="../jquery.jui_pagination.css">

<link rel="stylesheet" href="index.css">


<script src="../lib/jquery-1.8.2/jquery-1.8.2.min.js"
type="text/javascript"></script>

<script src="../lib/jquery-ui-1.8.24.custom/js/jquery-ui-1.8.24.custom.min.js"
type="text/javascript"></script>

<script src="../lib/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js"
type="text/javascript"></script>

<script src="../jquery.jui_pagination.js" type="text/javascript"></script>

<!-- <script type="text/javascript"
src="http://jqueryui.com/themeroller/themeswitchertool/">
</script>-->

<script src="index.js" type="text/javascript"></script>

</head>
<body>

<div id="switcher" style="margin-bottom: 20px;"></div>

<p>Project page: <a href="https://github.com/pontikis/jui_pagination">https://github.com/pontikis/jui_pagination</a>
</p>

<div id="demo_pag1"></div>

<div id="demo_pag2"></div>

</body>
</html>
18 changes: 18 additions & 0 deletions demo/index.js
@@ -0,0 +1,18 @@
$(function() {

/* $('#switcher').themeswitcher();*/

$("#demo_pag1").jui_pagination({
currentPage: 1,
visiblePageLinks: 10,
totalPages: 100
});

$("#demo_pag2").jui_pagination({
currentPage: 10,
visiblePageLinks: 5,
totalPages: 300
});

});

17 changes: 17 additions & 0 deletions jquery.jui_pagination.css
@@ -0,0 +1,17 @@
.nav-pane {
overflow: auto;
text-align: center;
}

.nav-item {
display: inline-block;
margin: 3px;
font-size: 12px;
text-align: center;
padding-left: 2px;
padding-right: 2px;
}

.nav-link {
text-decoration: none;
}
120 changes: 120 additions & 0 deletions jquery.jui_pagination.js
@@ -0,0 +1,120 @@
/**
* jquery pagination plugin
* Requires jquery, jquery-ui
* Copyright 2012 Christos Pontikis (http://pontikis.net)
* Project page https://github.com/pontikis/jui_pagination
* Release 1.00 - ??/10/2012
* License MIT
*/
(function($) {

var pluginName = 'jui_pagination';

// private methods

// public methods
var methods = {

/**
* @constructor
* @param options
* @return {*}
*/
init: function(options) {

var elem = this;

return this.each(function() {

var settings = elem.data(pluginName);
if(typeof(settings) == 'undefined') {
var defaults = {
currentPage: 1,
visiblePageLinks: 10,
navPages_id_prefix: 'nav_',
slider_id_prefix: 'sld_',
next_id_prefix: 'next_',
last_id_prefix: 'last_',
top_id_prefix: 'top_',
prev_id_prefix: 'prev_',
onPageClick: function() {
}
};
settings = $.extend({}, defaults, options);
elem.data(pluginName, settings);
} else {
settings = $.extend({}, settings, options);
}

var container_id = elem.attr("id");
var nav_pages_id = elem.jui_pagination('getOption', 'navPages_id_prefix') + container_id;
var slider_id = elem.jui_pagination('getOption', 'slider_id_prefix') + container_id;

var nav_html = '';



nav_html += '<div id="' + nav_pages_id + '" class="nav-pane ui-widget ui-widget-header ui-corner-all">';

nav_html += '<div class="nav-item ui-widget-header"><a href="javascript:void(0);" class="nav-link">&laquo;</a></div>';
nav_html += '<div class="nav-item ui-widget-header"><a href="javascript:void(0);" class="nav-link">&larr;</a></div>';

nav_html += '<div class="nav-item ui-widget-header"><a href="javascript:void(0);" class="nav-link">1</a></div>';
nav_html += '<div class="nav-item ui-widget-header">2</div>';
nav_html += '<div class="nav-item ui-widget-header">3</div>';

nav_html += '<div class="nav-item ui-widget-header"><a href="javascript:void(0);" class="nav-link">&rarr;</a></div>';
nav_html += '<div class="nav-item ui-widget-header"><a href="javascript:void(0);" class="nav-link">&raquo;</a></div>';
nav_html += '</div>';

nav_html += '<div style="clear: both; padding-top: 5px; padding-bottom: 5px;"></div>';

nav_html += '<div id="' + slider_id + '">';
nav_html += '</div>';

elem.html(nav_html);

$("#" + slider_id).slider({});

});
},

/**
* Get any option set to plugin using its name (as string)
* Usage: $(element).jui_datagrid('getOption', some_option);
* @param opt
* @return {*}
*/
getOption: function(opt) {
var elem = this;
return elem.data(pluginName)[opt];
},

/**
* Destroy plugin
* @param options
* @return {*|jQuery}
*/
destroy: function(options) {
return $(this).each(function() {
var $this = $(this);

$this.removeData(pluginName);
});
}
};

$.fn.jui_pagination = function(method) {

// Method calling logic
if(methods[method]) {
return methods[ method ].apply(this, Array.prototype.slice.call(arguments, 1));
} else if(typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.' + pluginName);
}

};

})(jQuery);
2 changes: 2 additions & 0 deletions lib/jquery-1.8.2/jquery-1.8.2.min.js

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 73945fa

Please sign in to comment.