Commit a20a6377 authored by friendica's avatar friendica

merge upstream, slider work, refactor ping module, language selection work

parent 599f3d29
......@@ -7,6 +7,66 @@ require_once("include/html2bbcode.php");
require_once("include/bbcode.php");
require_once("include/markdownify/markdownify.php");
function get_bb_tag_pos($s, $name, $occurance = 1) {
if($occurance < 1)
$occurance = 1;
$start_open = -1;
for($i = 1; $i <= $occurance; $i++) {
if( $start_open !== false)
$start_open = strpos($s, '[' . $name, $start_open + 1); // allow [name= type tags
}
if( $start_open === false)
return false;
$start_equal = strpos($s, '=', $start_open);
$start_close = strpos($s, ']', $start_open);
if( $start_close === false)
return false;
$start_close++;
$end_open = strpos($s, '[/' . $name . ']', $start_close);
if( $end_open === false)
return false;
$res = array( 'start' => array('open' => $start_open, 'close' => $start_close),
'end' => array('open' => $end_open, 'close' => $end_open + strlen('[/' . $name . ']')) );
if( $start_equal !== false)
$res['start']['equal'] = $start_equal + 1;
return $res;
}
function bb_tag_preg_replace($pattern, $replace, $name, $s) {
$string = $s;
$occurance = 1;
$pos = get_bb_tag_pos($string, $name, $occurance);
while($pos !== false && $occurance < 1000) {
$start = substr($string, 0, $pos['start']['open']);
$subject = substr($string, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
$end = substr($string, $pos['end']['close']);
if($end === false)
$end = '';
$subject = preg_replace($pattern, $replace, $subject);
$string = $start . $subject . $end;
$occurance++;
$pos = get_bb_tag_pos($string, $name, $occurance);
}
return $string;
}
// we don't want to support a bbcode specific markdown interpreter
// and the markdown library we have is pretty good, but provides HTML output.
// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
......@@ -51,10 +111,10 @@ function diaspora2bb($s) {
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3]$2$3[/url]',$s);
//$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s);
$s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s);
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);
$s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s);
$s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]','url',$s);
$s = bb_tag_preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]','url',$s);
$s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/ \/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]','url',$s);
$s = bb_tag_preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]','url',$s);
// remove duplicate adjacent code tags
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);
......
......@@ -1221,6 +1221,7 @@ function diaspora_comment($importer,$xml,$msg) {
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id'];
$datarray['type'] = 'remote-comment';
$datarray['wall'] = $parent_item['wall'];
$datarray['gravity'] = GRAVITY_COMMENT;
$datarray['guid'] = $guid;
......@@ -1658,8 +1659,8 @@ function diaspora_like($importer,$xml,$msg) {
// likes on comments not supported here and likes on photos not supported by Diaspora
if($target_type !== 'Post')
return;
// if($target_type !== 'Post')
// return;
$contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']);
if(! $contact) {
......@@ -2232,22 +2233,30 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
// $theiraddr = $contact['addr'];
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select guid from item where parent = %d and id = %d limit 1",
intval($item['parent']),
intval($item['parent'])
);
if($item['thr-parent']) {
$p = q("select guid, type, uri, `parent-uri` from item where uri = '%s' limit 1",
dbesc($item['thr-parent'])
);
}
else {
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select guid, type, uri, `parent-uri` from item where parent = %d and id = %d limit 1",
intval($item['parent']),
intval($item['parent'])
);
}
if(count($p))
$parent_guid = $p[0]['guid'];
$parent = $p[0];
else
return;
if($item['verb'] === ACTIVITY_LIKE) {
$tpl = get_markup_template('diaspora_like.tpl');
$like = true;
$target_type = 'Post';
$target_type = ( $parent['uri'] === $parent['parent-uri'] ? 'Post' : 'Comment');
// $target_type = (strpos($parent['type'], 'comment') ? 'Comment' : 'Post');
// $positive = (($item['deleted']) ? 'false' : 'true');
$positive = 'true';
......@@ -2264,15 +2273,15 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
// sign it
if($like)
$signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
$signed_text = $item['guid'] . ';' . $target_type . ';' . $parent['guid'] . ';' . $positive . ';' . $myaddr;
else
$signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
$signed_text = $item['guid'] . ';' . $parent['guid'] . ';' . $text . ';' . $myaddr;
$authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha256'));
$msg = replace_macros($tpl,array(
'$guid' => xmlify($item['guid']),
'$parent_guid' => xmlify($parent_guid),
'$parent_guid' => xmlify($parent['guid']),
'$target_type' =>xmlify($target_type),
'$authorsig' => xmlify($authorsig),
'$body' => xmlify($text),
......@@ -2300,15 +2309,22 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$text = html_entity_decode(bb2diaspora($body));
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select guid from item where parent = %d and id = %d limit 1",
intval($item['parent']),
intval($item['parent'])
);
if($item['thr-parent']) {
$p = q("select guid, type, uri, `parent-uri` from item where uri = '%s' limit 1",
dbesc($item['thr-parent'])
);
}
else {
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select guid, type, uri, `parent-uri` from item where parent = %d and id = %d limit 1",
intval($item['parent']),
intval($item['parent'])
);
}
if(count($p))
$parent_guid = $p[0]['guid'];
$parent = $p[0];
else
return;
......@@ -2326,7 +2342,8 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
elseif($item['verb'] === ACTIVITY_LIKE) {
$like = true;
$target_type = 'Post';
$target_type = ( $parent['uri'] === $parent['parent-uri'] ? 'Post' : 'Comment');
// $target_type = (strpos($parent['type'], 'comment') ? 'Comment' : 'Post');
// $positive = (($item['deleted']) ? 'false' : 'true');
$positive = 'true';
......@@ -2361,9 +2378,9 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
if($relay_retract)
$sender_signed_text = $item['guid'] . ';' . $target_type;
elseif($like)
$sender_signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $handle;
$sender_signed_text = $item['guid'] . ';' . $target_type . ';' . $parent['guid'] . ';' . $positive . ';' . $handle;
else
$sender_signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $handle;
$sender_signed_text = $item['guid'] . ';' . $parent['guid'] . ';' . $text . ';' . $handle;
// Sign the relayable with the top-level owner's signature
//
......@@ -2380,7 +2397,7 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$msg = replace_macros($tpl,array(
'$guid' => xmlify($item['guid']),
'$parent_guid' => xmlify($parent_guid),
'$parent_guid' => xmlify($parent['guid']),
'$target_type' =>xmlify($target_type),
'$authorsig' => xmlify($authorsig),
'$parentsig' => xmlify($parentauthorsig),
......
......@@ -236,10 +236,10 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
$tpl = get_markup_template("group_side.tpl");
$o = replace_macros($tpl, array(
'$title' => t('Groups'),
'$edittext' => t('Edit group'),
'$createtext' => t('Create a new group'),
'$ungrouped' => (($every === 'contacts') ? t('Contacts not in any group') : ''),
'$title' => t('Contact Groups'),
'$edittext' => t('Edit contact group'),
'$createtext' => t('Create a new contact group'),
'$ungrouped' => (($every === 'contacts') ? t('Contacts not in any contact group') : ''),
'$groups' => $groups,
'$add' => t('add'),
));
......
......@@ -896,7 +896,7 @@ function item_store($arr,$force_parent = false) {
if($r[0]['uri'] != $r[0]['parent-uri']) {
$arr['thr-parent'] = $arr['parent-uri'];
$arr['parent-uri'] = $r[0]['parent-uri'];
$z = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `parent-uri` = '%s' AND `uid` = %d
$z = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `parent-uri` = '%s' AND `uid` = %d
ORDER BY `id` ASC LIMIT 1",
dbesc($r[0]['parent-uri']),
dbesc($r[0]['parent-uri']),
......
<?php
function detect_language($s) {
$detected_languages = array(
'Albanian' => 'sq',
'Arabic' => 'ar',
'Azeri' => 'az',
'Bengali' => 'bn',
'Bulgarian' => 'bg',
'Cebuano' => '',
'Croatian' => 'hr',
'Czech' => 'cz',
'Danish' => 'da',
'Dutch' => 'nl',
'English' => 'en',
'Estonian' => 'et',
'Farsi' => 'fa',
'Finnish' => 'fi',
'French' => 'fr',
'German' => 'de',
'Hausa' => 'ha',
'Hawaiian' => '',
'Hindi' => 'hi',
'Hungarian' => 'hu',
'Icelandic' => 'is',
'Indonesian' => 'id',
'Italian' => 'it',
'Kazakh' => 'kk',
'Kyrgyz' => 'ky',
'Latin' => 'la',
'Latvian' => 'lv',
'Lithuanian' => 'lt',
'Macedonian' => 'mk',
'Mongolian' => 'mn',
'Nepali' => 'ne',
'Norwegian' => 'no',
'Pashto' => 'ps',
'Pidgin' => '',
'Polish' => 'pl',
'Portuguese' => 'pt',
'Romanian' => 'ro',
'Russian' => 'ru',
'Serbian' => 'sr',
'Slovak' => 'sk',
'Slovene' => 'sl',
'Somali' => 'so',
'Spanish' => 'es',
'Swahili' => 'sw',
'Swedish' => 'sv',
'Tagalog' => 'tl',
'Turkish' => 'tr',
'Ukrainian' => 'uk',
'Urdu' => 'ur',
'Uzbek' => 'uz',
'Vietnamese' => 'vi',
'Welsh' => 'cy'
);
require_once('Text/LanguageDetect.php');
$min_length = get_config('system','language_detect_min_length');
if($min_length === false)
$min_length = LANGUAGE_DETECT_MIN_LENGTH;
$min_confidence = get_config('system','language_detect_min_confidence');
if($min_confidence === false)
$min_confidence = LANGUAGE_DETECT_MIN_CONFIDENCE;
$naked_body = preg_replace('/\[(.+?)\]/','',$s);
if(mb_strlen($naked_body) < intval($min_length))
return '';
$l = new Text_LanguageDetect;
$lng = $l->detectConfidence($naked_body);
logger('detect language: ' . print_r($lng,true) . $naked_body, LOGGER_DATA);
if((! $lng) || (! (x($lng,'language')))) {
return '';
}
if($lng['confidence'] < (float) $min_confidence) {
logger('detect language: confidence less than ' . (float) $min_confidence, LOGGER_DATA);
return '';
}
return(($lng && (x($lng,'language'))) ? $detected_languages[ucfirst($lng['language'])] : '');
}
......@@ -356,7 +356,10 @@ if($a->module != 'install') {
* Build the page - now that we have all the components
*/
$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => current_theme_url()));
$a->page['htmlhead'] = replace_macros($a->page['htmlhead'],
array('$stylesheet' => current_theme_url(),
'$theme' => current_theme()
));
$page = $a->page;
$profile = $a->profile;
......
*/.DS_Store
.DS_Store
The MIT License (MIT)
Copyright (c) 2012 Egor Khmelev
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.
\ No newline at end of file
css_compiler: js_compiler
mkdir -p bin
cat css/jslider.css css/jslider.blue.css css/jslider.plastic.css css/jslider.round.css css/jslider.round.plastic.css > bin/jquery.slider.all.css
java -jar tools/yuicompressor-2.4.7.jar --type=css bin/jquery.slider.all.css > bin/jquery.slider.min.css
rm -f bin/jquery.slider.all.css
js_compiler:
mkdir -p bin
rm -f bin/jquery.slider.all.js bin/jquery.slider.min.js
cat js/jshashtable-2.1_src.js js/jquery.numberformatter-1.2.3.js js/tmpl.js js/jquery.dependClass-0.1.js js/draggable-0.1.js js/jquery.slider.js > bin/jquery.slider.all.js
uglifyjs -nc bin/jquery.slider.all.js > bin/jquery.slider.min.js
rm -f bin/jquery.slider.all.js
# jQuery Slider plugin
jQuery Slider is easy to use and multifunctional jQuery plugin.
[Check out demos and documentations here](http://egorkhmelev.github.com/jslider/)
## License
(MIT License) — Copyright &copy; 2012 Egor Khmelev
\ No newline at end of file
.jslider .jslider-bg i,.jslider .jslider-pointer{background:url(../img/jslider.png) no-repeat 0 0}.jslider{display:block;width:100%;height:1em;position:relative;top:.6em;font-family:Arial,sans-serif}.jslider table{width:100%;border-collapse:collapse;border:0}.jslider td,.jslider th{padding:0;vertical-align:top;text-align:left;border:0}.jslider table,.jslider table tr,.jslider table tr td{width:100%;vertical-align:top}.jslider .jslider-bg{position:relative}.jslider .jslider-bg i{height:5px;position:absolute;font-size:0;top:0}.jslider .jslider-bg .l{width:50%;background-position:0 0;left:0}.jslider .jslider-bg .r{width:50%;left:50%;background-position:right 0}.jslider .jslider-bg .v{position:absolute;width:60%;left:20%;top:0;height:5px;background-position:0 -20px}.jslider .jslider-pointer{width:13px;height:15px;background-position:0 -40px;position:absolute;left:20%;top:-4px;margin-left:-6px;cursor:pointer;cursor:hand}.jslider .jslider-pointer-hover{background-position:-20px -40px}.jslider .jslider-pointer-to{left:80%}.jslider .jslider-label{font-size:9px;line-height:12px;color:black;opacity:.4;white-space:nowrap;padding:0 2px;position:absolute;top:-18px;left:0}.jslider .jslider-label-to{left:auto;right:0}.jslider .jslider-value{font-size:9px;white-space:nowrap;padding:1px 2px 0;position:absolute;top:-19px;left:20%;background:white;line-height:12px;-moz-border-radius:2px;-webkit-border-radius:2px;-o-border-radius:2px;border-radius:2px}.jslider .jslider-value-to{left:80%}.jslider .jslider-label small,.jslider .jslider-value small{position:relative;top:-0.4em}.jslider .jslider-scale{position:relative;top:9px}.jslider .jslider-scale span{position:absolute;height:5px;border-left:1px solid #999;font-size:0}.jslider .jslider-scale ins{font-size:9px;text-decoration:none;position:absolute;left:0;top:5px;color:#999}.jslider-single .jslider-pointer-to,.jslider-single .jslider-value-to,.jslider-single .jslider-bg .v,.jslider-limitless .jslider-label{display:none}.jslider_blue .jslider-bg i,.jslider_blue .jslider-pointer{background-image:url(../img/jslider.blue.png)}.jslider_plastic .jslider-bg i,.jslider_plastic .jslider-pointer{background-image:url(../img/jslider.plastic.png)}.jslider_round .jslider-bg i,.jslider_round .jslider-pointer{background-image:url(../img/jslider.round.png)}.jslider_round .jslider-pointer{width:17px;height:17px;top:-6px;margin-left:-8px}.jslider_round_plastic .jslider-bg i,.jslider_round_plastic .jslider-pointer{background-image:url(../img/jslider.round.plastic.png)}.jslider_round_plastic .jslider-pointer{width:18px;height:18px;top:-7px;margin-left:-8px}
\ No newline at end of file
This diff is collapsed.
.jslider_blue .jslider-bg i,
.jslider_blue .jslider-pointer { background-image: url(../img/jslider.blue.png); }
\ No newline at end of file
.jslider .jslider-bg i,
.jslider .jslider-pointer { background: url(../img/jslider.png) no-repeat 0 0; }
.jslider { display: block; width: 100%; height: 1em; position: relative; top: 0.6em; font-family: Arial, sans-serif; }
.jslider table { width: 100%; border-collapse: collapse; border: 0; }
.jslider td, .jslider th { padding: 0; vertical-align: top; text-align: left; border: 0; }
.jslider table,
.jslider table tr,
.jslider table tr td { width: 100%; vertical-align: top; }
.jslider .jslider-bg { position: relative; }
.jslider .jslider-bg i { height: 5px; position: absolute; font-size: 0; top: 0; }
.jslider .jslider-bg .l { width: 50%; background-position: 0 0; left: 0; }
.jslider .jslider-bg .r { width: 50%; left: 50%; background-position: right 0; }
.jslider .jslider-bg .v { position: absolute; width: 60%; left: 20%; top: 0; height: 5px; background-position: 0 -20px; }
.jslider .jslider-pointer { width: 13px; height: 15px; background-position: 0 -40px; position: absolute; left: 20%; top: -4px; margin-left: -6px; cursor: pointer; cursor: hand; }
.jslider .jslider-pointer-hover { background-position: -20px -40px; }
.jslider .jslider-pointer-to { left: 80%; }
.jslider .jslider-label { font-size: 9px; line-height: 12px; color: black; opacity: 0.4; white-space: nowrap; padding: 0px 2px; position: absolute; top: -18px; left: 0px; }
.jslider .jslider-label-to { left: auto; right: 0; }
.jslider .jslider-value { font-size: 9px; white-space: nowrap; padding: 1px 2px 0; position: absolute; top: -19px; left: 20%; background: white; line-height: 12px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -o-border-radius: 2px; border-radius: 2px; }
.jslider .jslider-value-to { left: 80%; }
.jslider .jslider-label small,
.jslider .jslider-value small { position: relative; top: -0.4em; }
.jslider .jslider-scale { position: relative; top: 9px; }
.jslider .jslider-scale span { position: absolute; height: 5px; border-left: 1px solid #999; font-size: 0; }
.jslider .jslider-scale ins { font-size: 9px; text-decoration: none; position: absolute; left: 0px; top: 5px; color: #999; }
.jslider-single .jslider-pointer-to,
.jslider-single .jslider-value-to,
.jslider-single .jslider-bg .v,
.jslider-limitless .jslider-label { display: none; }
.jslider_plastic .jslider-bg i,
.jslider_plastic .jslider-pointer { background-image: url(../img/jslider.plastic.png); }
.jslider_round .jslider-bg i,
.jslider_round .jslider-pointer { background-image: url(../img/jslider.round.png); }
.jslider_round .jslider-pointer { width: 17px; height: 17px; top: -6px; margin-left: -8px; }
.jslider_round_plastic .jslider-bg i,
.jslider_round_plastic .jslider-pointer { background-image: url(../img/jslider.round.plastic.png); }
.jslider_round_plastic .jslider-pointer { width: 18px; height: 18px; top: -7px; margin-left: -8px; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>jSlider</title>
<!-- bin/jquery.slider.min.css -->
<link rel="stylesheet" href="css/jslider.css" type="text/css">
<link rel="stylesheet" href="css/jslider.blue.css" type="text/css">
<link rel="stylesheet" href="css/jslider.plastic.css" type="text/css">
<link rel="stylesheet" href="css/jslider.round.css" type="text/css">
<link rel="stylesheet" href="css/jslider.round.plastic.css" type="text/css">
<!-- end -->
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<!-- bin/jquery.slider.min.js -->
<script type="text/javascript" src="js/jshashtable-2.1_src.js"></script>
<script type="text/javascript" src="js/jquery.numberformatter-1.2.3.js"></script>
<script type="text/javascript" src="js/tmpl.js"></script>
<script type="text/javascript" src="js/jquery.dependClass-0.1.js"></script>
<script type="text/javascript" src="js/draggable-0.1.js"></script>
<script type="text/javascript" src="js/jquery.slider.js"></script>
<!-- end -->
<style type="text/css" media="screen">
body { background: #EEF0F7; }
.layout { padding: 50px; font-family: Georgia, serif; }
.layout-slider { margin-bottom: 60px; width: 50%; }
.layout-slider-settings { font-size: 12px; padding-bottom: 10px; }
.layout-slider-settings pre { font-family: Courier; }
</style>
</head>
<body>
<div class="layout">
<div class="layout-slider" style="width: 100%">
Slider <span style="display: inline-block; width: 400px; padding: 0 5px;"><input id="Slider1" type="slider" name="price" value="30000.5;60000" /></span> in string
</div>
<script type="text/javascript" charset="utf-8">
jQuery("#Slider1").slider({ from: 1000, to: 100000, step: 500, smooth: true, round: 0, dimension: "&nbsp;$", skin: "plastic" });
</script>
<div class="layout-slider-settings">
<pre>{
from: 5,
to: 50,
step: 2.5,
round: 1,
format: { format: '##.0', locale: 'de' },
dimension: '&amp;nbsp;€'
}</pre>
</div>
<div class="layout-slider">
<input id="SliderSingle" type="slider" name="price" value="20" />
</div>
<script type="text/javascript" charset="utf-8">
jQuery("#SliderSingle").slider({ from: 5, to: 50, step: 2.5, round: 1, format: { format: '##.0', locale: 'de' }, dimension: '&nbsp;€', skin: "round" });
</script>
<div class="layout-slider-settings">
<pre>{
from: 5000,
to: 150000,
heterogeneity: ['50/50000'],
step: 1000,
dimension: '&amp;nbsp;$'
}</pre>
</div>
<div class="layout-slider">
<input id="Slider2" type="slider" name="price" value="5000;50000" />
</div>
<script type="text/javascript" charset="utf-8">
jQuery("#Slider2").slider({ from: 5000, to: 150000, heterogeneity: ['50/50000'], step: 1000, dimension: '&nbsp;$' });
</script>
<div class="layout-slider-settings">
<pre>{
from: 0,
to: 500,
heterogeneity: ['50/100', '75/250'],
scale: [0, '|', 50, '|' , '100', '|', 250, '|', 500],
limits: false,
step: 1,
dimension: '&amp;nbsp;m&lt;small&gt;2&lt;/small&gt;'
}</pre>
</div>
<div class="layout-slider">
<input id="Slider3" type="slider" name="area" value="25;75" />
</div>
<script type="text/javascript" charset="utf-8">
jQuery("#Slider3").slider({ from: 0, to: 500, heterogeneity: ['50/100', '75/250'], scale: [0, '|', 50, '|', '100', '|', 250, '|', 500], limits: false, step: 1, dimension: '&nbsp;m<small>2</small>', skin: "round_plastic" });
</script>
<div class="layout-slider-settings">
<pre>{
from: 1,
to: 30,
heterogeneity: ['50/5', '75/15'],
scale: [1, '|', 3, '|', '5', '|', 15, '|', 30],
limits: false,
step: 1,
dimension: '',
skin: "blue"
}</pre>
</div>
<div class="layout-slider">
<input id="Slider4" type="slider" name="area" value="2;10" />
</div>
<script type="text/javascript" charset="utf-8">
jQuery("#Slider4").slider({ from: 1, to: 30, heterogeneity: ['50/5', '75/15'], scale: [1, '|', 3, '|', '5', '|', 15, '|', 30], limits: false, step: 1, dimension: '', skin: "blue", callback: function( value ){ console.dir( this ); } });
</script>
<div class="layout-slider-settings">
<pre>{
from: 480,
to: 1020,
step: 15,
dimension: '',
scale: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00'],
limits: false,
calculate: function( value ){
var hours = Math.floor( value / 60 );
var mins = ( value - hours*60 );
return (hours &lt; 10 ? "0"+hours : hours) + ":" + ( mins == 0 ? "00" : mins );
},
onstatechange: function( value ){
console.dir( this );
}
}</pre>
</div>
<div class="layout-slider">
<input id="Slider5" type="slider" name="area" value="600;720" />
</div>
<script type="text/javascript" charset="utf-8">
jQuery("#Slider5").slider({ from: 480, to: 1020, step: 15, dimension: '', scale: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00'], limits: false, calculate: function( value ){
var hours = Math.floor( value / 60 );
var mins = ( value - hours*60 );
return (hours < 10 ? "0"+hours : hours) + ":" + ( mins == 0 ? "00" : mins );
}})
</script>
</div>
</body>
</html>
\ No newline at end of file
/**
* draggable - Class allows to make any element draggable
*
* Written by
* Egor Khmelev (hmelyoff@gmail.com)
*
* Licensed under the MIT (MIT-LICENSE.txt).
*
* @author Egor Khmelev
* @version 0.1.0-BETA ($Id$)
*
**/
(function( $ ){
function Draggable(){
this._init.apply( this, arguments );
};
Draggable.prototype.oninit = function(){
};
Draggable.prototype.events = function(){
};
Draggable.prototype.onmousedown = function(){
this.ptr.css({ position: "absolute" });
};
Draggable.prototype.onmousemove = function( evt, x, y ){
this.ptr.css({ left: x, top: y });
};
Draggable.prototype.onmouseup = function(){
};
Draggable.prototype.isDefault = {
drag: false,
clicked: false,
toclick: true,
mouseup: false
};
Draggable.prototype._init = function(){
if( arguments.length > 0 ){
this.ptr = $(arguments[0]);
this.outer = $(".draggable-outer");
this.is = {};
$.extend( this.is, this.isDefault );
var _offset = this.ptr.offset();
this.d = {
left: _offset.left,
top: _offset.top,
width: this.ptr.width(),
height: this.ptr.height()
};
this.oninit.apply( this, arguments );
this._events();
}
};
Draggable.prototype._getPageCoords = function( event ){
if( event.targetTouches && event.targetTouches[0] ){
return { x: event.targetTouches[0].pageX, y: event.targetTouches[0].pageY };