Merge #555
This commit is contained in:
commit
0ff6da6d3c
118 changed files with 2391 additions and 12463 deletions
13
.gitignore
vendored
13
.gitignore
vendored
|
@ -5,7 +5,12 @@ thumbs
|
|||
!lib/images
|
||||
*.phar
|
||||
*.sqlite
|
||||
/lib/vendor/
|
||||
|
||||
#Composer
|
||||
composer.phar
|
||||
composer.lock
|
||||
/vendor/
|
||||
|
||||
# Created by http://www.gitignore.io
|
||||
|
||||
|
@ -20,13 +25,6 @@ Desktop.ini
|
|||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
### OSX ###
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
|
@ -35,7 +33,6 @@ $RECYCLE.BIN/
|
|||
# Icon must ends with two \r.
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
|
|
13
.htaccess
13
.htaccess
|
@ -31,8 +31,6 @@
|
|||
php_flag magic_quotes_runtime 0
|
||||
</IfModule>
|
||||
|
||||
DefaultType image/jpeg
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
<FilesMatch "([0-9a-f]{32}|\.(gif|jpe?g|png|css|js))$">
|
||||
|
@ -49,3 +47,14 @@ DefaultType image/jpeg
|
|||
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
|
||||
AddOutputFilterByType DEFLATE application/x-javascript application/javascript
|
||||
</ifmodule>
|
||||
|
||||
DefaultType image/jpeg
|
||||
AddType audio/mp4 f4a f4b m4a
|
||||
AddType audio/ogg oga ogg opus
|
||||
AddType image/bmp bmp
|
||||
AddType image/svg+xml svg svgz
|
||||
AddType image/webp webp
|
||||
AddType video/mp4 f4v f4p m4v mp4
|
||||
AddType video/ogg ogv
|
||||
AddType video/webm webm
|
||||
AddType video/x-flv flv
|
71
.travis.yml
71
.travis.yml
|
@ -1,43 +1,54 @@
|
|||
language: php
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- nightly
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
sudo: false
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DB=mysql
|
||||
- DB=pgsql
|
||||
- DB=sqlite
|
||||
- DB=mysql
|
||||
- DB=pgsql
|
||||
- DB=sqlite
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- vendor
|
||||
- $HOME/.composer/cache
|
||||
|
||||
before_install:
|
||||
- travis_retry composer self-update && composer --version #travis is bad at updating composer
|
||||
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
|
||||
|
||||
install:
|
||||
- mkdir -p data/config
|
||||
- if [[ "$DB" == "pgsql" ]]; then psql -c "SELECT set_config('log_statement', 'all', false);" -U postgres; fi
|
||||
- if [[ "$DB" == "pgsql" ]]; then psql -c "CREATE DATABASE shimmie;" -U postgres; fi
|
||||
- if [[ "$DB" == "pgsql" ]]; then echo '<?php define("DATABASE_DSN", "pgsql:user=postgres;password=;host=;dbname=shimmie");' > data/config/auto_install.conf.php ; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then mysql -e "SET GLOBAL general_log = 'ON';" -uroot; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then mysql -e "CREATE DATABASE shimmie;" -uroot; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then echo '<?php define("DATABASE_DSN", "mysql:user=root;password=;host=localhost;dbname=shimmie");' > data/config/auto_install.conf.php ; fi
|
||||
- if [[ "$DB" == "sqlite" ]]; then echo '<?php define("DATABASE_DSN", "sqlite:shimmie.sqlite");' > data/config/auto_install.conf.php ; fi
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- mkdir -p data/config
|
||||
- if [[ "$DB" == "pgsql" ]]; then psql -c "SELECT set_config('log_statement', 'all', false);" -U postgres; fi
|
||||
- if [[ "$DB" == "pgsql" ]]; then psql -c "CREATE DATABASE shimmie;" -U postgres; fi
|
||||
- if [[ "$DB" == "pgsql" ]]; then echo '<?php define("DATABASE_DSN", "pgsql:user=postgres;password=;host=;dbname=shimmie");' > data/config/auto_install.conf.php ; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then mysql -e "SET GLOBAL general_log = 'ON';" -uroot; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then mysql -e "CREATE DATABASE shimmie;" -uroot; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then echo '<?php define("DATABASE_DSN", "mysql:user=root;password=;host=localhost;dbname=shimmie");' > data/config/auto_install.conf.php ; fi
|
||||
- if [[ "$DB" == "sqlite" ]]; then echo '<?php define("DATABASE_DSN", "sqlite:shimmie.sqlite");' > data/config/auto_install.conf.php ; fi
|
||||
- composer global require "fxp/composer-asset-plugin:~1.1" --no-plugins
|
||||
- composer install
|
||||
- php install.php
|
||||
|
||||
script:
|
||||
- php install.php
|
||||
- phpunit --configuration tests/phpunit.xml --coverage-clover=data/coverage.clover
|
||||
- phpunit --configuration tests/phpunit.xml --coverage-clover=data/coverage.clover
|
||||
|
||||
after_failure:
|
||||
- head -n 100 data/config/*
|
||||
- ls /var/run/mysql*
|
||||
- ls /var/log/*mysql*
|
||||
- cat /var/log/mysql.err
|
||||
- cat /var/log/mysql.log
|
||||
- cat /var/log/mysql/error.log
|
||||
- cat /var/log/mysql/slow.log
|
||||
- ls /var/log/postgresql
|
||||
- cat /var/log/postgresql/postgresql*
|
||||
- head -n 100 data/config/*
|
||||
- ls /var/run/mysql*
|
||||
- ls /var/log/*mysql*
|
||||
- cat /var/log/mysql.err
|
||||
- cat /var/log/mysql.log
|
||||
- cat /var/log/mysql/error.log
|
||||
- cat /var/log/mysql/slow.log
|
||||
- ls /var/log/postgresql
|
||||
- cat /var/log/postgresql/postgresql*
|
||||
|
||||
after_script:
|
||||
- php ocular.phar code-coverage:upload --format=php-clover data/coverage.clover
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover data/coverage.clover
|
||||
|
|
|
@ -26,6 +26,7 @@ check out one of the versioned branches.
|
|||
|
||||
# Installation
|
||||
|
||||
0. Download the latest release under [Releases](https://github.com/shish/shimmie2/releases).
|
||||
1. Create a blank database
|
||||
2. Unzip shimmie into a folder on the web host
|
||||
3. Visit the folder with a web browser
|
||||
|
@ -33,6 +34,14 @@ check out one of the versioned branches.
|
|||
5. Click "install". Hopefully you'll end up at the welcome screen; if
|
||||
not, you should be given instructions on how to fix any errors~
|
||||
|
||||
# Installation (Development)
|
||||
|
||||
0. Download the shimmie via the "Download Zip" button.
|
||||
1. Install [Composer](https://getcomposer.org/). (If you don't already have it)
|
||||
2. Run `composer global require "fxp/composer-asset-plugin:~1.1" --no-plugins`. (This is installed globally due to a known composer bug)
|
||||
3. Run `composer install`
|
||||
4. Follow instructions noted in "Installation" (Excluding 0).
|
||||
|
||||
## Upgrade from 2.3.X
|
||||
|
||||
1. Backup your current files and database!
|
||||
|
|
61
composer.json
Normal file
61
composer.json
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"type" : "project",
|
||||
"license" : "GPL-2.0",
|
||||
"minimum-stability" : "dev",
|
||||
|
||||
"repositories" : [
|
||||
{
|
||||
"type" : "package",
|
||||
"package" : {
|
||||
"name" : "ifixit/php-akismet",
|
||||
"version" : "1.0",
|
||||
"source" : {
|
||||
"url" : "https://github.com/iFixit/php-akismet.git",
|
||||
"type" : "git",
|
||||
"reference" : "126b4b9182230678a585338be4cfca24c9129dc9"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"require" : {
|
||||
"php" : ">=5.4.8",
|
||||
|
||||
"flexihash/flexihash" : "^2.0.0",
|
||||
"ifixit/php-akismet" : "1.*",
|
||||
"google/recaptcha" : "~1.1",
|
||||
"dapphp/securimage" : "3.6.*",
|
||||
"ircmaxell/password-compat" : "1.0.4",
|
||||
|
||||
"bower-asset/jquery" : "1.12.3",
|
||||
"bower-asset/jquery-timeago" : "1.5.2",
|
||||
"bower-asset/tablesorter" : "2.0.5",
|
||||
"bower-asset/mediaelement" : "2.21.1",
|
||||
"bower-asset/js-cookie" : "2.1.1"
|
||||
},
|
||||
|
||||
"vendor-copy": {
|
||||
"vendor/bower-asset/jquery/dist/jquery.min.js" : "lib/vendor/js/jquery-1.12.3.min.js",
|
||||
"vendor/bower-asset/jquery/dist/jquery.min.map" : "lib/vendor/js/jquery-1.12.3.min.map",
|
||||
"vendor/bower-asset/jquery-timeago/jquery.timeago.js" : "lib/vendor/js/jquery.timeago.js",
|
||||
"vendor/bower-asset/tablesorter/jquery.tablesorter.min.js" : "lib/vendor/js/jquery.tablesorter.min.js",
|
||||
"vendor/bower-asset/mediaelement/build/flashmediaelement.swf" : "lib/vendor/swf/flashmediaelement.swf",
|
||||
"vendor/bower-asset/js-cookie/src/js.cookie.js" : "lib/vendor/js/js.cookie.js"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"pre-install-cmd" : [
|
||||
"php -r \"array_map('unlink', array_merge(glob('lib/vendor/js/j*.{js,map}', GLOB_BRACE), glob('lib/vendor/css/*.css'), glob('lib/vendor/swf/*.swf')));\""
|
||||
],
|
||||
"pre-update-cmd" : [
|
||||
"php -r \"array_map('unlink', array_merge(glob('lib/vendor/js/j*.{js,map}', GLOB_BRACE), glob('lib/vendor/css/*.css'), glob('lib/vendor/swf/*.swf')));\""
|
||||
],
|
||||
|
||||
"post-install-cmd" : [
|
||||
"php -r \"array_map('copy', array_keys(json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']), json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']);\""
|
||||
],
|
||||
"post-update-cmd" : [
|
||||
"php -r \"array_map('copy', array_keys(json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']), json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']);\""
|
||||
]
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ global $config, $database, $user, $page;
|
|||
require_once "core/sys_config.inc.php";
|
||||
require_once "core/util.inc.php";
|
||||
require_once "lib/context.php";
|
||||
require_once "vendor/autoload.php";
|
||||
|
||||
// set up and purify the environment
|
||||
_version_check();
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
* Classes *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
require_once "lib/flexihash.php";
|
||||
|
||||
/**
|
||||
* Class Image
|
||||
*
|
||||
|
@ -391,7 +388,7 @@ class Image {
|
|||
* @return string
|
||||
*/
|
||||
public function get_image_link() {
|
||||
return $this->get_link('image_ilink', '_images/$hash/$id%20-%20$tags.$ext', 'image/$id.jpg');
|
||||
return $this->get_link('image_ilink', '_images/$hash/$id%20-%20$tags.$ext', 'image/$id.$ext');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -724,7 +721,7 @@ class Image {
|
|||
|
||||
if($opts != $fh_last_opts) {
|
||||
$fh_last_opts = $opts;
|
||||
$flexihash = new Flexihash();
|
||||
$flexihash = new Flexihash\Flexihash();
|
||||
foreach(explode(",", $opts) as $opt) {
|
||||
$parts = explode("=", $opt);
|
||||
$parts_count = count($parts);
|
||||
|
|
|
@ -338,18 +338,40 @@ class Page {
|
|||
$this->add_html_header("<link rel='icon' type='image/x-icon' href='$data_href/favicon.ico'>", 41);
|
||||
$this->add_html_header("<link rel='apple-touch-icon' href='$data_href/apple-touch-icon.png'>", 42);
|
||||
|
||||
//We use $config_latest to make sure cache is reset if config is ever updated.
|
||||
$config_latest = 0;
|
||||
foreach(zglob("data/config/*") as $conf) {
|
||||
$config_latest = max($config_latest, filemtime($conf));
|
||||
}
|
||||
|
||||
$css_files = array();
|
||||
/*** Generate CSS cache files ***/
|
||||
$css_lib_latest = $config_latest;
|
||||
$css_lib_files = zglob("lib/vendor/css/*.css");
|
||||
foreach($css_lib_files as $css) {
|
||||
$css_lib_latest = max($css_lib_latest, filemtime($css));
|
||||
}
|
||||
$css_lib_md5 = md5(serialize($css_lib_files));
|
||||
$css_lib_cache_file = data_path("cache/style.lib.{$theme_name}.{$css_lib_latest}.{$css_lib_md5}.css");
|
||||
if(!file_exists($css_lib_cache_file)) {
|
||||
$css_lib_data = "";
|
||||
foreach($css_lib_files as $file) {
|
||||
$file_data = file_get_contents($file);
|
||||
$pattern = '/url[\s]*\([\s]*["\']?([^"\'\)]+)["\']?[\s]*\)/';
|
||||
$replace = 'url("../../'.dirname($file).'/$1")';
|
||||
$file_data = preg_replace($pattern, $replace, $file_data);
|
||||
$css_lib_data .= $file_data . "\n";
|
||||
}
|
||||
file_put_contents($css_lib_cache_file, $css_lib_data);
|
||||
}
|
||||
$this->add_html_header("<link rel='stylesheet' href='$data_href/$css_lib_cache_file' type='text/css'>", 43);
|
||||
|
||||
$css_latest = $config_latest;
|
||||
foreach(array_merge(zglob("lib/*.css"), zglob("ext/*/style.css"), zglob("themes/$theme_name/style.css")) as $css) {
|
||||
$css_files[] = $css;
|
||||
$css_files = array_merge(zglob("lib/shimmie.css"), zglob("ext/{".ENABLED_EXTS."}/style.css"), zglob("themes/$theme_name/style.css"));
|
||||
foreach($css_files as $css) {
|
||||
$css_latest = max($css_latest, filemtime($css));
|
||||
}
|
||||
$css_cache_file = data_path("cache/style.$theme_name.$css_latest.css");
|
||||
$css_md5 = md5(serialize($css_files));
|
||||
$css_cache_file = data_path("cache/style.main.{$theme_name}.{$css_latest}.{$css_md5}.css");
|
||||
if(!file_exists($css_cache_file)) {
|
||||
$css_data = "";
|
||||
foreach($css_files as $file) {
|
||||
|
@ -361,15 +383,32 @@ class Page {
|
|||
}
|
||||
file_put_contents($css_cache_file, $css_data);
|
||||
}
|
||||
$this->add_html_header("<link rel='stylesheet' href='$data_href/$css_cache_file' type='text/css'>", 43);
|
||||
$this->add_html_header("<link rel='stylesheet' href='$data_href/$css_cache_file' type='text/css'>", 100);
|
||||
|
||||
/*** Generate JS cache files ***/
|
||||
$js_lib_latest = $config_latest;
|
||||
$js_lib_files = zglob("lib/vendor/js/*.js");
|
||||
foreach($js_lib_files as $js) {
|
||||
$js_lib_latest = max($js_lib_latest, filemtime($js));
|
||||
}
|
||||
$js_lib_md5 = md5(serialize($js_lib_files));
|
||||
$js_lib_cache_file = data_path("cache/script.lib.{$theme_name}.{$js_lib_latest}.{$js_lib_md5}.js");
|
||||
if(!file_exists($js_lib_cache_file)) {
|
||||
$js_data = "";
|
||||
foreach($js_lib_files as $file) {
|
||||
$js_data .= file_get_contents($file) . "\n";
|
||||
}
|
||||
file_put_contents($js_lib_cache_file, $js_data);
|
||||
}
|
||||
$this->add_html_header("<script src='$data_href/$js_lib_cache_file' type='text/javascript'></script>", 45);
|
||||
|
||||
$js_files = array();
|
||||
$js_latest = $config_latest;
|
||||
foreach(array_merge(zglob("lib/*.js"), zglob("ext/*/script.js"), zglob("themes/$theme_name/script.js")) as $js) {
|
||||
$js_files[] = $js;
|
||||
$js_files = array_merge(zglob("lib/shimmie.js"), zglob("ext/{".ENABLED_EXTS."}/script.js"), zglob("themes/$theme_name/script.js"));
|
||||
foreach($js_files as $js) {
|
||||
$js_latest = max($js_latest, filemtime($js));
|
||||
}
|
||||
$js_cache_file = data_path("cache/script.$theme_name.$js_latest.js");
|
||||
$js_md5 = md5(serialize($js_files));
|
||||
$js_cache_file = data_path("cache/script.main.{$theme_name}.{$js_latest}.{$js_md5}.js");
|
||||
if(!file_exists($js_cache_file)) {
|
||||
$js_data = "";
|
||||
foreach($js_files as $file) {
|
||||
|
@ -377,7 +416,7 @@ class Page {
|
|||
}
|
||||
file_put_contents($js_cache_file, $js_data);
|
||||
}
|
||||
$this->add_html_header("<script src='$data_href/$js_cache_file' type='text/javascript'></script>", 44);
|
||||
$this->add_html_header("<script src='$data_href/$js_cache_file' type='text/javascript'></script>", 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
require_once "lib/password.php";
|
||||
|
||||
/** @private */
|
||||
function _new_user($row) {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
require_once "lib/recaptchalib.php";
|
||||
require_once "lib/securimage/securimage.php";
|
||||
require_once "lib/context.php";
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
|
@ -633,14 +631,12 @@ function captcha_get_html() {
|
|||
if($user->is_anonymous() && $config->get_bool("comment_captcha")) {
|
||||
$r_publickey = $config->get_string("api_recaptcha_pubkey");
|
||||
if(!empty($r_publickey)) {
|
||||
$captcha = recaptcha_get_html($r_publickey);
|
||||
}
|
||||
else {
|
||||
$captcha = "
|
||||
<div class=\"g-recaptcha\" data-sitekey=\"{$r_publickey}\"></div>
|
||||
<script type=\"text/javascript\" src=\"https://www.google.com/recaptcha/api.js\"></script>";
|
||||
} else {
|
||||
session_start();
|
||||
//$securimg = new Securimage();
|
||||
$base = get_base_href();
|
||||
$captcha = "<br/><img src='$base/lib/securimage/securimage_show.php?sid=". md5(uniqid(time())) ."'>".
|
||||
"<br/>CAPTCHA: <input type='text' name='code' value='' />";
|
||||
$captcha = Securimage::getCaptchaHtml(['securimage_path' => './vendor/dapphp/securimage/']);
|
||||
}
|
||||
}
|
||||
return $captcha;
|
||||
|
@ -657,22 +653,18 @@ function captcha_check() {
|
|||
if($user->is_anonymous() && $config->get_bool("comment_captcha")) {
|
||||
$r_privatekey = $config->get_string('api_recaptcha_privkey');
|
||||
if(!empty($r_privatekey)) {
|
||||
$resp = recaptcha_check_answer(
|
||||
$r_privatekey,
|
||||
$_SERVER["REMOTE_ADDR"],
|
||||
$_POST["recaptcha_challenge_field"],
|
||||
$_POST["recaptcha_response_field"]
|
||||
);
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($r_privatekey);
|
||||
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if(!$resp->is_valid) {
|
||||
log_info("core", "Captcha failed (ReCaptcha): " . $resp->error);
|
||||
if(!$resp->isSuccess()) {
|
||||
log_info("core", "Captcha failed (ReCaptcha): " . implode("", $resp->getErrorCodes()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
session_start();
|
||||
$securimg = new Securimage();
|
||||
if($securimg->check($_POST['code']) == false) {
|
||||
if($securimg->check($_POST['captcha_code']) == FALSE) {
|
||||
log_info("core", "Captcha failed (Securimage)");
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@
|
|||
* Documentation:
|
||||
*/
|
||||
|
||||
require_once "lib/S3.php";
|
||||
require_once "ext/amazon_s3/S3.php";
|
||||
|
||||
class UploadS3 extends Extension {
|
||||
public function onInitExt(InitExtEvent $event) {
|
||||
|
|
7
ext/autocomplete/lib/jquery-ui.min.css
vendored
Normal file
7
ext/autocomplete/lib/jquery-ui.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
13
ext/autocomplete/lib/jquery-ui.min.js
vendored
Normal file
13
ext/autocomplete/lib/jquery-ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
ext/autocomplete/lib/jquery-ui.theme.min.css
vendored
Normal file
5
ext/autocomplete/lib/jquery-ui.theme.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
69
ext/autocomplete/lib/jquery.tagit.css
Normal file
69
ext/autocomplete/lib/jquery.tagit.css
Normal file
|
@ -0,0 +1,69 @@
|
|||
ul.tagit {
|
||||
padding: 1px 5px;
|
||||
overflow: auto;
|
||||
margin-left: inherit; /* usually we don't want the regular ul margins. */
|
||||
margin-right: inherit;
|
||||
}
|
||||
ul.tagit li {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 2px 5px 2px 0;
|
||||
}
|
||||
ul.tagit li.tagit-choice {
|
||||
position: relative;
|
||||
line-height: inherit;
|
||||
}
|
||||
input.tagit-hidden-field {
|
||||
display: none;
|
||||
}
|
||||
ul.tagit li.tagit-choice-read-only {
|
||||
padding: .2em .5em .2em .5em;
|
||||
}
|
||||
|
||||
ul.tagit li.tagit-choice-editable {
|
||||
padding: .2em 18px .2em .5em;
|
||||
}
|
||||
|
||||
ul.tagit li.tagit-new {
|
||||
padding: .25em 4px .25em 0;
|
||||
}
|
||||
|
||||
ul.tagit li.tagit-choice a.tagit-label {
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
ul.tagit li.tagit-choice .tagit-close {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: .1em;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
/* used for some custom themes that don't need image icons */
|
||||
ul.tagit li.tagit-choice .tagit-close .text-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
ul.tagit li.tagit-choice input {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 2px 5px 2px 0;
|
||||
}
|
||||
ul.tagit input[type="text"] {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
|
||||
-moz-box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: inherit;
|
||||
background-color: inherit;
|
||||
outline: none;
|
||||
}
|
18
ext/autocomplete/lib/tag-it.min.js
vendored
Normal file
18
ext/autocomplete/lib/tag-it.min.js
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
//Removed TAB keybind
|
||||
;(function(b){b.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var a=
|
||||
this;this.element.is("input")?(this.tagList=b("<ul></ul>").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.addClass("tagit-hidden-field")):this.tagList=this.element.find("ul, ol").andSelf().last();this.tagInput=b('<input type="text" />').addClass("ui-widget-content");this.options.readOnly&&this.tagInput.attr("disabled","disabled");this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex);this.options.placeholderText&&this.tagInput.attr("placeholder",
|
||||
this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(a,e){var d=a.term.toLowerCase(),c=b.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(c=this._subtractArray(c,this.assignedTags()));e(c)});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(b,d){a._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=
|
||||
0));b.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=b.proxy(this.options.autocomplete.source,this));b.isFunction(this.options.tagSource)&&(this.options.tagSource=b.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(b('<li class="tagit-new"></li>').append(this.tagInput)).click(function(d){var c=b(d.target);c.hasClass("tagit-label")?(c=c.closest(".tagit-choice"),c.hasClass("removed")||a._trigger("onTagClicked",
|
||||
d,{tag:c,tagLabel:a.tagLabel(c)})):a.tagInput.focus()});var c=!1;if(this.options.singleField)if(this.options.singleFieldNode){var d=b(this.options.singleFieldNode),f=d.val().split(this.options.singleFieldDelimiter);d.val("");b.each(f,function(b,d){a.createTag(d,null,!0);c=!0})}else this.options.singleFieldNode=b('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);c||this.tagList.children("li").each(function(){b(this).hasClass("tagit-new")||
|
||||
(a.createTag(b(this).text(),b(this).attr("class"),!0),b(this).remove())});this.tagInput.keydown(function(c){if(c.which==b.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var d=a._lastTag();!a.options.removeConfirmation||d.hasClass("remove")?a.removeTag(d):a.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");if(c.which===b.ui.keyCode.COMMA&&!1===c.shiftKey||c.which===b.ui.keyCode.ENTER||c.which==
|
||||
c.which==b.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=b.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==b.trim(a.tagInput.val()).charAt(0)&&'"'==b.trim(a.tagInput.val()).charAt(b.trim(a.tagInput.val()).length-1)&&0!==b.trim(a.tagInput.val()).length-1))c.which===b.ui.keyCode.ENTER&&""===a.tagInput.val()||c.preventDefault(),a.options.autocomplete.autoFocus&&a.tagInput.data("autocomplete-open")||(a.tagInput.autocomplete("close"),a.createTag(a._cleanedInput()))}).blur(function(b){a.tagInput.data("autocomplete-open")||
|
||||
a.createTag(a._cleanedInput())});if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source)d={select:function(b,c){a.createTag(c.item.value);return!1}},b.extend(d,this.options.autocomplete),d.source=this.options.tagSource||d.source,this.tagInput.autocomplete(d).bind("autocompleteopen.tagit",function(b,c){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(b,c){a.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")},
|
||||
destroy:function(){b.Widget.prototype.destroy.call(this);this.element.unbind(".tagit");this.tagList.unbind(".tagit");this.tagInput.removeData("autocomplete-open");this.tagList.removeClass("tagit ui-widget ui-widget-content ui-corner-all tagit-hidden-field");this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){b(this).hasClass("tagit-new")?b(this).remove():(b(this).removeClass("tagit-choice ui-widget-content ui-state-default ui-state-highlight ui-corner-all remove tagit-choice-editable tagit-choice-read-only"),
|
||||
b(this).text(b(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove());return this},_cleanedInput:function(){return b.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var a=this,c=[];this.options.singleField?(c=b(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter),
|
||||
""===c[0]&&(c=[])):this._tags().each(function(){c.push(a.tagLabel(this))});return c},_updateSingleTagsField:function(a){b(this.options.singleFieldNode).val(a.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(a,c){for(var d=[],f=0;f<a.length;f++)-1==b.inArray(a[f],c)&&d.push(a[f]);return d},tagLabel:function(a){return this.options.singleField?b(a).find(".tagit-label:first").text():b(a).find("input:first").val()},_showAutocomplete:function(){this.tagInput.autocomplete("search",
|
||||
"")},_findTagByLabel:function(a){var c=this,d=null;this._tags().each(function(f){if(c._formatStr(a)==c._formatStr(c.tagLabel(this)))return d=b(this),!1});return d},_isNew:function(a){return!this._findTagByLabel(a)},_formatStr:function(a){return this.options.caseSensitive?a:b.trim(a.toLowerCase())},_effectExists:function(a){return Boolean(b.effects&&(b.effects[a]||b.effects.effect&&b.effects.effect[a]))},createTag:function(a,c,d){var f=this;a=b.trim(a);this.options.preprocessTag&&(a=this.options.preprocessTag(a));
|
||||
if(""===a)return!1;if(!this.options.allowDuplicates&&!this._isNew(a))return a=this._findTagByLabel(a),!1!==this._trigger("onTagExists",null,{existingTag:a,duringInitialization:d})&&this._effectExists("highlight")&&a.effect("highlight"),!1;if(this.options.tagLimit&&this._tags().length>=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:d}),!1;var g=b(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(a),e=b("<li></li>").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(c).append(g);
|
||||
this.options.readOnly?e.addClass("tagit-choice-read-only"):(e.addClass("tagit-choice-editable"),c=b("<span></span>").addClass("ui-icon ui-icon-close"),c=b('<a><span class="text-icon">\u00d7</span></a>').addClass("tagit-close").append(c).click(function(a){f.removeTag(e)}),e.append(c));this.options.singleField||(g=g.html(),e.append('<input type="hidden" value="'+g+'" name="'+this.options.fieldName+'" class="tagit-hidden-field" />'));!1!==this._trigger("beforeTagAdded",null,{tag:e,tagLabel:this.tagLabel(e),
|
||||
duringInitialization:d})&&(this.options.singleField&&(g=this.assignedTags(),g.push(a),this._updateSingleTagsField(g)),this._trigger("onTagAdded",null,e),this.tagInput.val(""),this.tagInput.parent().before(e),this._trigger("afterTagAdded",null,{tag:e,tagLabel:this.tagLabel(e),duringInitialization:d}),this.options.showAutocompleteOnFocus&&!d&&setTimeout(function(){f._showAutocomplete()},0))},removeTag:function(a,c){c="undefined"===typeof c?this.options.animate:c;a=b(a);this._trigger("onTagRemoved",
|
||||
null,a);if(!1!==this._trigger("beforeTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})){if(this.options.singleField){var d=this.assignedTags(),f=this.tagLabel(a),d=b.grep(d,function(a){return a!=f});this._updateSingleTagsField(d)}if(c){a.addClass("removed");var d=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],g=this;d.push(function(){a.remove();g._trigger("afterTagRemoved",null,{tag:a,tagLabel:g.tagLabel(a)})});a.fadeOut("fast").hide.apply(a,d).dequeue()}else a.remove(),
|
||||
this._trigger("afterTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})}},removeTagByLabel:function(a,b){var d=this._findTagByLabel(a);if(!d)throw"No such tag exists with the name '"+a+"'";this.removeTag(d,b)},removeAll:function(){var a=this;this._tags().each(function(b,d){a.removeTag(d,!1)})}})})(jQuery);
|
98
ext/autocomplete/lib/tagit.ui-zendesk.css
Normal file
98
ext/autocomplete/lib/tagit.ui-zendesk.css
Normal file
|
@ -0,0 +1,98 @@
|
|||
|
||||
/* Optional scoped theme for tag-it which mimics the zendesk widget. */
|
||||
|
||||
|
||||
ul.tagit {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #C6C6C6;
|
||||
background: inherit;
|
||||
}
|
||||
ul.tagit li.tagit-choice {
|
||||
-moz-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
border: 1px solid #CAD8F3;
|
||||
|
||||
background: none;
|
||||
background-color: #DEE7F8;
|
||||
|
||||
font-weight: normal;
|
||||
}
|
||||
ul.tagit li.tagit-choice .tagit-label:not(a) {
|
||||
color: #555;
|
||||
}
|
||||
ul.tagit li.tagit-choice a.tagit-close {
|
||||
text-decoration: none;
|
||||
}
|
||||
ul.tagit li.tagit-choice .tagit-close {
|
||||
right: .4em;
|
||||
}
|
||||
ul.tagit li.tagit-choice .ui-icon {
|
||||
display: none;
|
||||
}
|
||||
ul.tagit li.tagit-choice .tagit-close .text-icon {
|
||||
display: inline;
|
||||
font-family: arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
color: #777;
|
||||
}
|
||||
ul.tagit li.tagit-choice:hover, ul.tagit li.tagit-choice.remove {
|
||||
background-color: #bbcef1;
|
||||
border-color: #6d95e0;
|
||||
}
|
||||
ul.tagit li.tagit-choice a.tagLabel:hover,
|
||||
ul.tagit li.tagit-choice a.tagit-close .text-icon:hover {
|
||||
color: #222;
|
||||
}
|
||||
ul.tagit input[type="text"] {
|
||||
color: #333333;
|
||||
background: none;
|
||||
}
|
||||
.ui-widget {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
/* Forked from a jQuery UI theme, so that we don't require the jQuery UI CSS as a dependency. */
|
||||
.tagit-autocomplete.ui-autocomplete { position: absolute; cursor: default; }
|
||||
* html .tagit-autocomplete.ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
||||
.tagit-autocomplete.ui-menu {
|
||||
list-style:none;
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
display:block;
|
||||
float: left;
|
||||
}
|
||||
.tagit-autocomplete.ui-menu .ui-menu {
|
||||
margin-top: -3px;
|
||||
}
|
||||
.tagit-autocomplete.ui-menu .ui-menu-item {
|
||||
margin:0;
|
||||
padding: 0;
|
||||
zoom: 1;
|
||||
float: left;
|
||||
clear: left;
|
||||
width: 100%;
|
||||
}
|
||||
.tagit-autocomplete.ui-menu .ui-menu-item a {
|
||||
text-decoration:none;
|
||||
display:block;
|
||||
padding:.2em .4em;
|
||||
line-height:1.5;
|
||||
zoom:1;
|
||||
}
|
||||
.tagit-autocomplete .ui-menu .ui-menu-item a.ui-state-hover,
|
||||
.tagit-autocomplete .ui-menu .ui-menu-item a.ui-state-active {
|
||||
font-weight: normal;
|
||||
margin: -1px;
|
||||
}
|
||||
.tagit-autocomplete.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff 50% 50% repeat-x; color: #222222; }
|
||||
.tagit-autocomplete.ui-corner-all, .tagit-autocomplete .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; }
|
||||
.tagit-autocomplete .ui-state-hover, .tagit-autocomplete .ui-state-focus { border: 1px solid #999999; background: #dadada; font-weight: normal; color: #212121; }
|
||||
.tagit-autocomplete .ui-state-active { border: 1px solid #aaaaaa; }
|
||||
|
||||
.tagit-autocomplete .ui-widget-content { border: 1px solid #aaaaaa; }
|
||||
.tagit .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px,1px,1px,1px); }
|
||||
|
||||
|
45
ext/autocomplete/main.php
Normal file
45
ext/autocomplete/main.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/*
|
||||
* Name: Autocomplete
|
||||
* Author: Daku <admin@codeanimu.net>
|
||||
* Description: Adds autocomplete to search & tagging.
|
||||
*/
|
||||
|
||||
class AutoComplete extends Extension {
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $page, $database;
|
||||
|
||||
if($event->page_matches("api/internal/autocomplete")) {
|
||||
if(!isset($_GET["s"])) return;
|
||||
|
||||
//$limit = 0;
|
||||
$cache_key = "autocomplete-" . strtolower($_GET["s"]);
|
||||
$limitSQL = "";
|
||||
$SQLarr = array("search"=>$_GET["s"]."%");
|
||||
if(isset($_GET["limit"]) && $_GET["limit"] !== 0){
|
||||
$limitSQL = "LIMIT :limit";
|
||||
$SQLarr['limit'] = $_GET["limit"];
|
||||
$cache_key .= "-" . $_GET["limit"];
|
||||
}
|
||||
|
||||
$res = $database->cache->get($cache_key);
|
||||
if(!$res) {
|
||||
$res = $database->get_pairs($database->scoreql_to_sql("
|
||||
SELECT tag, count
|
||||
FROM tags
|
||||
WHERE SCORE_STRNORM(tag) LIKE SCORE_STRNORM(:search)
|
||||
AND count > 0
|
||||
ORDER BY count DESC
|
||||
$limitSQL"), $SQLarr
|
||||
);
|
||||
$database->cache->set($cache_key, $res, 600);
|
||||
}
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/json");
|
||||
$page->set_data(json_encode($res));
|
||||
}
|
||||
|
||||
$this->theme->build_autocomplete($page);
|
||||
}
|
||||
}
|
58
ext/autocomplete/script.js
Normal file
58
ext/autocomplete/script.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
$(function(){
|
||||
$('[name=search]').tagit({
|
||||
singleFieldDelimiter: ' ',
|
||||
beforeTagAdded: function(event, ui) {
|
||||
// give special class to negative tags
|
||||
if(ui.tagLabel[0] === '-') {
|
||||
ui.tag.addClass('tag-negative');
|
||||
}else{
|
||||
ui.tag.addClass('tag-positive');
|
||||
}
|
||||
},
|
||||
autocomplete : ({
|
||||
source: function (request, response) {
|
||||
var isNegative = (request.term[0] === '-');
|
||||
$.ajax({
|
||||
url: base_href + '/api/internal/autocomplete',
|
||||
data: {'s': (isNegative ? request.term.substring(1) : request.term)},
|
||||
dataType : 'json',
|
||||
type : 'GET',
|
||||
success : function (data) {
|
||||
response($.map(data, function (count, item) {
|
||||
item = (isNegative ? '-'+item : item);
|
||||
return {
|
||||
label : item + ' ('+count+')',
|
||||
value : item
|
||||
}
|
||||
}));
|
||||
},
|
||||
error : function (request, status, error) {
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength: 1
|
||||
})
|
||||
});
|
||||
|
||||
$('.ui-autocomplete-input').keydown(function(e) {
|
||||
var keyCode = e.keyCode || e.which;
|
||||
|
||||
//Stop tags containing space.
|
||||
if(keyCode == 32) {
|
||||
e.preventDefault();
|
||||
|
||||
$('[name=search]').tagit('createTag', $(this).val());
|
||||
$(this).autocomplete('close');
|
||||
} else if (keyCode == 9) {
|
||||
e.preventDefault();
|
||||
|
||||
var tag = $('.tagit-autocomplete[style*=\"display: block\"] > li:first').text();
|
||||
if(tag){
|
||||
$('[name=search]').tagit('createTag', tag);
|
||||
$('.ui-autocomplete-input').autocomplete('close');
|
||||
$('.ui-autocomplete-input').val(''); //If tag already exists, make sure to remove duplicate.
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
8
ext/autocomplete/style.css
Normal file
8
ext/autocomplete/style.css
Normal file
|
@ -0,0 +1,8 @@
|
|||
#Navigationleft .blockbody { overflow: visible; }
|
||||
|
||||
.tagit { background: white !important; border: 1px solid grey !important; cursor: text; }
|
||||
.tagit-choice { cursor: initial; }
|
||||
input[name=search] ~ input[type=submit] { display: inline-block !important; }
|
||||
|
||||
.tag-negative { background: #ff8080 !important; }
|
||||
.tag-positive { background: #40bf40 !important; }
|
13
ext/autocomplete/theme.php
Normal file
13
ext/autocomplete/theme.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class AutoCompleteTheme extends Themelet {
|
||||
public function build_autocomplete(Page $page) {
|
||||
$base_href = get_base_href();
|
||||
// TODO: AJAX test and fallback.
|
||||
|
||||
$page->add_html_header("<script src='$base_href/ext/autocomplete/lib/jquery-ui.min.js' type='text/javascript'></script>");
|
||||
$page->add_html_header("<script src='$base_href/ext/autocomplete/lib/tag-it.min.js' type='text/javascript'></script>");
|
||||
$page->add_html_header('<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css">');
|
||||
$page->add_html_header("<link rel='stylesheet' type='text/css' href='$base_href/ext/autocomplete/lib/jquery.tagit.css' />");
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
* Formatting is done with the standard formatting API (normally BBCode)
|
||||
*/
|
||||
|
||||
require_once "lib/akismet.class.php";
|
||||
require_once "vendor/ifixit/php-akismet/akismet.class.php";
|
||||
|
||||
class CommentPostingEvent extends Event {
|
||||
/** @var int */
|
||||
|
|
|
@ -5,12 +5,7 @@ class ExtManagerTheme extends Themelet {
|
|||
$h_en = $editable ? "<th>Enabled</th>" : "";
|
||||
$html = "
|
||||
".make_form(make_link("ext_manager/set"))."
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
$(\"#extensions\").tablesorter();
|
||||
});
|
||||
</script>
|
||||
<table id='extensions' class='zebra'>
|
||||
<table id='extensions' class='zebra sortable'>
|
||||
<thead>
|
||||
<tr>$h_en<th>Name</th><th>Description</th></tr>
|
||||
</thead>
|
||||
|
|
|
@ -14,29 +14,43 @@
|
|||
* In the future, it may be necessary to change the user agent checks to reflect the current state of H.264 support.<br><br>
|
||||
* Made possible by:<br>
|
||||
* <a href='http://getid3.sourceforge.net/'>getID3()</a> - Gets media information with PHP (no bulky FFMPEG API required).<br>
|
||||
* <a href='http://jarisflvplayer.org/'>Jaris FLV Player</a> - GPLv3 flash multimedia player.
|
||||
*/
|
||||
|
||||
class VideoFileHandler extends DataHandlerExtension {
|
||||
public function onInitExt(InitExtEvent $event) {
|
||||
global $config;
|
||||
$config->set_default_string('video_thumb_engine', 'static');
|
||||
$config->set_default_string('thumb_ffmpeg_path', '');
|
||||
|
||||
// By default we generate thumbnails ignoring the aspect ratio of the video file.
|
||||
//
|
||||
// Why? - This allows Shimmie to work with older versions of FFmpeg by default,
|
||||
// rather than completely failing out of the box. If people complain that their
|
||||
// thumbnails are distorted, then they can turn this feature on manually later.
|
||||
$config->set_default_bool('video_thumb_ignore_aspect_ratio', true);
|
||||
if($config->get_int("ext_handle_video_version") < 1) {
|
||||
if($ffmpeg = shell_exec((PHP_OS == 'WINNT' ? 'where' : 'which') . ' ffmpeg')) {
|
||||
//ffmpeg exists in PATH, check if it's executable, and if so, default to it instead of static
|
||||
if(is_executable(strtok($ffmpeg, PHP_EOL))) {
|
||||
$config->set_default_string('video_thumb_engine', 'ffmpeg');
|
||||
$config->set_default_string('thumb_ffmpeg_path', 'ffmpeg');
|
||||
}
|
||||
} else {
|
||||
$config->set_default_string('video_thumb_engine', 'static');
|
||||
$config->set_default_string('thumb_ffmpeg_path', '');
|
||||
}
|
||||
|
||||
// By default we generate thumbnails ignoring the aspect ratio of the video file.
|
||||
//
|
||||
// Why? - This allows Shimmie to work with older versions of FFmpeg by default,
|
||||
// rather than completely failing out of the box. If people complain that their
|
||||
// thumbnails are distorted, then they can turn this feature on manually later.
|
||||
$config->set_default_bool('video_thumb_ignore_aspect_ratio', TRUE);
|
||||
|
||||
$config->set_int("ext_handle_video_version", 1);
|
||||
log_info("pools", "extension installed");
|
||||
}
|
||||
}
|
||||
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
//global $config;
|
||||
|
||||
$thumbers = array();
|
||||
$thumbers['None'] = "static";
|
||||
$thumbers['ffmpeg'] = "ffmpeg";
|
||||
|
||||
$thumbers = array(
|
||||
'None' => 'static',
|
||||
'ffmpeg' => 'ffmpeg'
|
||||
);
|
||||
|
||||
$sb = new SetupBlock("Video Thumbnail Options");
|
||||
|
||||
|
|
|
@ -4,45 +4,48 @@ class VideoFileHandlerTheme extends Themelet {
|
|||
public function display_image(Page $page, Image $image) {
|
||||
$data_href = get_base_href();
|
||||
$ilink = $image->get_image_link();
|
||||
$thumb_url = make_http($image->get_thumb_link()); //used as fallback image
|
||||
$ext = strtolower($image->get_ext());
|
||||
|
||||
if ($ext == "mp4") {
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<script language='JavaScript' type='text/javascript'>
|
||||
if( navigator.userAgent.match(/Firefox/i) ||
|
||||
navigator.userAgent.match(/Opera/i) ||
|
||||
(navigator.userAgent.match(/MSIE/i) && parseFloat(navigator.appVersion.split('MSIE')[1]) < 9)){
|
||||
document.write(\"<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&type=video&streamtype=file&controltype=0' name='flashvars'></object>\");
|
||||
}
|
||||
else {
|
||||
document.write(\"<video controls autoplay loop'>\");
|
||||
document.write(\"<source src='" . make_link("/image/" . $image->id) . "' type='video/mp4' />\");
|
||||
document.write(\"<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&type=video&streamtype=file&controltype=0' name='flashvars'></object>\");
|
||||
}
|
||||
</script>
|
||||
<noscript>Javascript appears to be disabled. Please enable it and try again.</noscript>";
|
||||
} elseif ($ext == "flv") {
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'>
|
||||
<param value='#000000' name='bgcolor'>
|
||||
<param name='allowFullScreen' value='true'>
|
||||
<param value='high' name='quality'>
|
||||
<param value='opaque' name='wmode'>
|
||||
<param value='source={$ilink}&type=video&streamtype=file&controltype=0' name='flashvars'>
|
||||
</object>";
|
||||
} elseif ($ext == "ogv") {
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<video controls autoplay loop>
|
||||
<source src='" . make_link("/image/" . $image->id) . "' type='video/ogg' />
|
||||
</video>";
|
||||
} elseif ($ext == "webm") {
|
||||
$ie_only = "<!--[if IE]><p>To view webm files with IE, please <a href='http://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
||||
$html = $ie_only ."Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<video controls autoplay loop>
|
||||
<source src='" . make_link("/image/" . $image->id) . "' type='video/webm' />
|
||||
</video>";
|
||||
}
|
||||
else {
|
||||
$full_url = make_http($ilink);
|
||||
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>";
|
||||
|
||||
//Browser media format support: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
|
||||
$supportedExts = ['mp4' => 'video/mp4', 'm4v' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'flv' => 'video/flv'];
|
||||
if(array_key_exists($ext, $supportedExts)) {
|
||||
//FLV isn't supported by <video>, but it should always fallback to the flash-based method.
|
||||
if($ext == "webm") {
|
||||
//Several browsers still lack WebM support sadly: http://caniuse.com/#feat=webm
|
||||
$html .= "<!--[if IE]><p>To view webm files with IE, please <a href='https://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
||||
}
|
||||
|
||||
$html_fallback = "
|
||||
<object width=\"100%\" height=\"480px\" type=\"application/x-shockwave-flash\" data=\"lib/vendor/swf/flashmediaelement.swf\">
|
||||
<param name=\"movie\" value=\"lib/vendor/swf/flashmediaelement.swf\" />
|
||||
|
||||
<param name=\"allowFullScreen\" value=\"true\" />
|
||||
<param name=\"wmode\" value=\"opaque\" />
|
||||
|
||||
<param name=\"flashVars\" value=\"controls=true&autoplay=true&poster={$thumb_url}&file={$full_url}\" />
|
||||
<img src=\"{$thumb_url}\" />
|
||||
</object>";
|
||||
|
||||
if($ext == "flv") {
|
||||
//FLV doesn't support <video>.
|
||||
$html .= $html_fallback;
|
||||
} else {
|
||||
$html .= "
|
||||
<video controls autoplay width=\"100%\">
|
||||
<source src='{$ilink}' type='{$supportedExts[$ext]}'>
|
||||
|
||||
<!-- If browser doesn't support filetype, fallback to flash -->
|
||||
{$html_fallback}
|
||||
|
||||
</video>";
|
||||
}
|
||||
|
||||
} else {
|
||||
//This should never happen, but just in case let's have a fallback..
|
||||
$html = "Video type '$ext' not recognised";
|
||||
}
|
||||
$page->add_block(new Block("Video", $html, "main", 10));
|
||||
|
|
13
ext/home/style.css
Normal file
13
ext/home/style.css
Normal file
|
@ -0,0 +1,13 @@
|
|||
div#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none; box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none;}
|
||||
div#front-page {text-align:center;}
|
||||
.space {margin-bottom: 1em;}
|
||||
div#front-page div#links a {margin: 0 0.5em;}
|
||||
div#front-page li {list-style-type: none; margin: 0;}
|
||||
@media (max-width: 800px) {
|
||||
div#front-page h1 {font-size: 3em; margin-top: 0.5em; margin-bottom: 0.5em;}
|
||||
#counter {display: none;}
|
||||
}
|
||||
|
||||
div#front-page > #search > form { margin: 0 auto; }
|
||||
div#front-page > #search > form > ul { width: 225px; vertical-align: middle; display: inline-block; }
|
||||
div#front-page > #search > form > input[type=submit]{ padding: 4px 6px; }
|
|
@ -13,17 +13,6 @@ class HomeTheme extends Themelet {
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
$hh
|
||||
</head>
|
||||
<style>
|
||||
div#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none; box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none;}
|
||||
div#front-page {text-align:center;}
|
||||
.space {margin-bottom: 1em;}
|
||||
div#front-page div#links a {margin: 0 0.5em;}
|
||||
div#front-page li {list-style-type: none; margin: 0;}
|
||||
@media (max-width: 800px) {
|
||||
div#front-page h1 {font-size: 3em; margin-top: 0.5em; margin-bottom: 0.5em;}
|
||||
#counter {display: none;}
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
$body
|
||||
</body>
|
||||
|
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
|
@ -30,7 +30,7 @@ class Notes extends Extension {
|
|||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||
");
|
||||
$database->execute("CREATE INDEX notes_image_id_idx ON notes(image_id)", array());
|
||||
|
||||
|
||||
$database->create_table("note_request", "
|
||||
id SCORE_AIPK,
|
||||
image_id INTEGER NOT NULL,
|
||||
|
@ -40,7 +40,7 @@ class Notes extends Extension {
|
|||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||
");
|
||||
$database->execute("CREATE INDEX note_request_image_id_idx ON note_request(image_id)", array());
|
||||
|
||||
|
||||
$database->create_table("note_histories", "
|
||||
id SCORE_AIPK,
|
||||
note_enable INTEGER NOT NULL,
|
||||
|
@ -68,110 +68,83 @@ class Notes extends Extension {
|
|||
log_info("notes", "extension installed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $page, $user;
|
||||
if($event->page_matches("note")) {
|
||||
|
||||
switch($event->get_arg(0)) {
|
||||
case "list": //index
|
||||
{
|
||||
$this->get_notes_list($event); // This should show images like post/list but i don't know how do that.
|
||||
break;
|
||||
}
|
||||
case "requests": // The same as post/list but only for note_request table.
|
||||
{
|
||||
$this->get_notes_requests($event); // This should shouw images like post/list but i don't know how do that.
|
||||
$this->get_notes_requests($event); // This should show images like post/list but i don't know how do that.
|
||||
break;
|
||||
}
|
||||
case "search":
|
||||
{
|
||||
if(!$user->is_anonymous())
|
||||
$this->theme->search_notes_page($page);
|
||||
break;
|
||||
}
|
||||
case "updated": //Thinking how biuld this function.
|
||||
{
|
||||
case "updated": //Thinking how to build this function.
|
||||
$this->get_histories($event);
|
||||
break;
|
||||
}
|
||||
case "history": //Thinking how biuld this function.
|
||||
{
|
||||
case "history": //Thinking how to build this function.
|
||||
$this->get_history($event);
|
||||
break;
|
||||
}
|
||||
case "revert":
|
||||
{
|
||||
$noteID = $event->get_arg(1);
|
||||
$noteID = $event->get_arg(1);
|
||||
$reviewID = $event->get_arg(2);
|
||||
if(!$user->is_anonymous()){
|
||||
$this->revert_history($noteID, $reviewID);
|
||||
}
|
||||
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("note/updated"));
|
||||
break;
|
||||
}
|
||||
case "add_note":
|
||||
{
|
||||
if(!$user->is_anonymous())
|
||||
$this->add_new_note();
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
break;
|
||||
}
|
||||
case "add_request":
|
||||
{
|
||||
if(!$user->is_anonymous())
|
||||
$this->add_note_request();
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
break;
|
||||
}
|
||||
case "nuke_notes":
|
||||
{
|
||||
if($user->is_admin())
|
||||
$this->nuke_notes();
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
break;
|
||||
}
|
||||
case "nuke_requests":
|
||||
{
|
||||
if($user->is_admin())
|
||||
$this->nuke_requests();
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
break;
|
||||
}
|
||||
case "edit_note":
|
||||
{
|
||||
if (!$user->is_anonymous()) {
|
||||
$this->update_note();
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
$page->set_redirect(make_link("post/view/" . $_POST["image_id"]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "delete_note":
|
||||
{
|
||||
if ($user->is_admin()) {
|
||||
$this->delete_note();
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".$_POST["image_id"]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("note/list"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +157,7 @@ class Notes extends Extension {
|
|||
global $page, $user;
|
||||
|
||||
//display form on image event
|
||||
$notes = $this->get_notes($event->image->id);
|
||||
$notes = $this->get_notes($event->image->id);
|
||||
$this->theme->display_note_system($page, $event->image->id, $notes, $user->is_admin());
|
||||
}
|
||||
|
||||
|
@ -223,8 +196,7 @@ class Notes extends Extension {
|
|||
$user = User::by_name($matches[1]);
|
||||
if(!is_null($user)) {
|
||||
$user_id = $user->id;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$user_id = -1;
|
||||
}
|
||||
|
||||
|
@ -250,8 +222,8 @@ class Notes extends Extension {
|
|||
"SELECT * ".
|
||||
"FROM notes ".
|
||||
"WHERE enable = ? AND image_id = ? ".
|
||||
"ORDER BY date ASC"
|
||||
, array('1', $imageID));
|
||||
"ORDER BY date ASC",
|
||||
array('1', $imageID));
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,23 +242,21 @@ class Notes extends Extension {
|
|||
$noteText = html_escape($_POST["note_text"]);
|
||||
|
||||
$database->execute("
|
||||
INSERT INTO notes
|
||||
(enable, image_id, user_id, user_ip, date, x1, y1, height, width, note)
|
||||
VALUES
|
||||
(?, ?, ?, ?, now(), ?, ?, ?, ?, ?)",
|
||||
INSERT INTO notes (enable, image_id, user_id, user_ip, date, x1, y1, height, width, note)
|
||||
VALUES (?, ?, ?, ?, now(), ?, ?, ?, ?, ?)",
|
||||
array(1, $imageID, $user_id, $_SERVER['REMOTE_ADDR'], $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText));
|
||||
|
||||
$noteID = $database->get_last_insert_id('notes_id_seq');
|
||||
|
||||
log_info("notes", "Note added {$noteID} by {$user->name}");
|
||||
|
||||
$database->Execute("UPDATE images SET notes=(SELECT COUNT(*) FROM notes WHERE image_id=?) WHERE id=?", array($imageID, $imageID));
|
||||
$database->execute("UPDATE images SET notes=(SELECT COUNT(*) FROM notes WHERE image_id=?) WHERE id=?", array($imageID, $imageID));
|
||||
|
||||
$this->add_history(1, $noteID, $imageID, $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* HERE WE ADD A REQUEST TO DATABASE
|
||||
*/
|
||||
|
@ -297,80 +267,68 @@ class Notes extends Extension {
|
|||
$user_id = $user->id;
|
||||
|
||||
$database->execute("
|
||||
INSERT INTO note_request
|
||||
(image_id, user_id, date)
|
||||
VALUES
|
||||
(?, ?, now())",
|
||||
INSERT INTO note_request (image_id, user_id, date)
|
||||
VALUES (?, ?, now())",
|
||||
array($image_id, $user_id));
|
||||
|
||||
$resultID = $database->get_last_insert_id('note_request_id_seq');
|
||||
|
||||
log_info("notes", "Note requested {$requestID} by {$user->name}");
|
||||
log_info("notes", "Note requested {$resultID} by {$user->name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* HERE WE EDIT THE NOTE
|
||||
*/
|
||||
private function update_note()
|
||||
{
|
||||
$imageID = int_escape($_POST["image_id"]);
|
||||
$noteID = int_escape($_POST["note_id"]);
|
||||
$noteX1 = int_escape($_POST["note_x1"]);
|
||||
$noteY1 = int_escape($_POST["note_y1"]);
|
||||
$noteHeight = int_escape($_POST["note_height"]);
|
||||
$noteWidth = int_escape($_POST["note_width"]);
|
||||
$noteText = sql_escape(html_escape($_POST["note_text"]));
|
||||
private function update_note() {
|
||||
global $database;
|
||||
|
||||
$note = array(
|
||||
"noteX1" => int_escape($_POST["note_x1"]),
|
||||
"noteY1" => int_escape($_POST["note_y1"]),
|
||||
"noteHeight" => int_escape($_POST["note_height"]),
|
||||
"noteWidth" => int_escape($_POST["note_width"]),
|
||||
"noteText" => sql_escape(html_escape($_POST["note_text"])),
|
||||
"imageID" => int_escape($_POST["image_id"]),
|
||||
"noteID" => int_escape($_POST["note_id"])
|
||||
);
|
||||
|
||||
// validate parameters
|
||||
if (is_null($imageID) || !is_numeric($imageID) ||
|
||||
is_null($noteID) || !is_numeric($noteID) ||
|
||||
is_null($noteX1) || !is_numeric($noteX1) ||
|
||||
is_null($noteY1) || !is_numeric($noteY1) ||
|
||||
is_null($noteHeight) || !is_numeric($noteHeight) ||
|
||||
is_null($noteWidth) || !is_numeric($noteWidth) ||
|
||||
is_null($noteText) || strlen($noteText) == 0)
|
||||
{
|
||||
if (array_search(NULL, $note)|| strlen($note['noteText']) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $database;
|
||||
$database->execute("UPDATE notes ".
|
||||
"SET x1 = ?, ".
|
||||
"y1 = ?, ".
|
||||
"height = ?, ".
|
||||
"width = ?,".
|
||||
"note = ? ".
|
||||
"WHERE image_id = ? AND id = ?", array($noteX1, $noteY1, $noteHeight, $noteWidth, $noteText, $imageID, $noteID));
|
||||
|
||||
$this->add_history(1, $noteID, $imageID, $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText);
|
||||
"SET x1 = ?, ".
|
||||
"y1 = ?, ".
|
||||
"height = ?, ".
|
||||
"width = ?,".
|
||||
"note = ? ".
|
||||
"WHERE image_id = ? AND id = ?", array_values($note));
|
||||
|
||||
$this->add_history(1, $note['noteID'], $note['imageID'], $note['noteX1'], $note['noteY1'], $note['noteHeight'], $note['noteWidth'], $note['noteText']);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* HERE WE DELETE THE NOTE
|
||||
*/
|
||||
private function delete_note()
|
||||
{
|
||||
global $user;
|
||||
private function delete_note() {
|
||||
global $user, $database;
|
||||
|
||||
$imageID = int_escape($_POST["image_id"]);
|
||||
$noteID = int_escape($_POST["note_id"]);
|
||||
|
||||
// validate parameters
|
||||
if( is_null($imageID) || !is_numeric($imageID) ||
|
||||
is_null($noteID) || !is_numeric($noteID))
|
||||
{
|
||||
if(is_null($imageID) || !is_numeric($imageID) || is_null($noteID) || !is_numeric($noteID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $database;
|
||||
|
||||
$database->execute("UPDATE notes ".
|
||||
"SET enable = ? ".
|
||||
"WHERE image_id = ? AND id = ?", array(0, $imageID, $noteID));
|
||||
|
||||
"SET enable = ? ".
|
||||
"WHERE image_id = ? AND id = ?", array(0, $imageID, $noteID));
|
||||
|
||||
log_info("notes", "Note deleted {$noteID} by {$user->name}");
|
||||
}
|
||||
|
||||
|
@ -385,9 +343,9 @@ class Notes extends Extension {
|
|||
$database->execute("DELETE FROM notes WHERE image_id = ?", array($image_id));
|
||||
log_info("notes", "Notes deleted from {$image_id} by {$user->name}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* HERE WE DELETE ALL REQUESTS FOR IMAGE
|
||||
*/
|
||||
|
@ -408,35 +366,28 @@ class Notes extends Extension {
|
|||
global $database, $config;
|
||||
|
||||
$pageNumber = $event->get_arg(1);
|
||||
|
||||
if(is_null($pageNumber) || !is_numeric($pageNumber))
|
||||
$pageNumber = 0;
|
||||
else if ($pageNumber <= 0)
|
||||
$pageNumber = 0;
|
||||
else
|
||||
$pageNumber--;
|
||||
if(is_null($pageNumber) || !is_numeric($pageNumber) || $pageNumber <= 0) {
|
||||
$pageNumber = 0;
|
||||
} else {
|
||||
$pageNumber--;
|
||||
}
|
||||
|
||||
$notesPerPage = $config->get_int('notesNotesPerPage');
|
||||
|
||||
//$result = $database->get_all("SELECT * FROM pool_images WHERE pool_id=?", array($poolID));
|
||||
|
||||
$get_notes = "
|
||||
SELECT DISTINCT image_id ".
|
||||
"FROM notes ".
|
||||
"WHERE enable = ? ".
|
||||
"ORDER BY date DESC LIMIT ?, ?";
|
||||
|
||||
$result = $database->Execute($get_notes, array(1, $pageNumber * $notesPerPage, $notesPerPage));
|
||||
|
||||
//$result = $database->get_all("SELECT * FROM pool_images WHERE pool_id=?", array($poolID));
|
||||
$result = $database->execute("SELECT DISTINCT image_id".
|
||||
"FROM notes ".
|
||||
"WHERE enable = ? ".
|
||||
"ORDER BY date DESC LIMIT ?, ?",
|
||||
array(1, $pageNumber * $notesPerPage, $notesPerPage));
|
||||
|
||||
$totalPages = ceil($database->get_one("SELECT COUNT(DISTINCT image_id) FROM notes") / $notesPerPage);
|
||||
|
||||
|
||||
$images = array();
|
||||
while(!$result->EOF) {
|
||||
$image = Image::by_id($result->fields["image_id"]);
|
||||
$images[] = array($image);
|
||||
$result->MoveNext();
|
||||
while($row = $result->fetch()) {
|
||||
$images[] = array(Image::by_id($row["image_id"]));
|
||||
}
|
||||
|
||||
|
||||
$this->theme->display_note_list($images, $pageNumber + 1, $totalPages);
|
||||
}
|
||||
|
||||
|
@ -445,60 +396,52 @@ class Notes extends Extension {
|
|||
* @param PageRequestEvent $event
|
||||
*/
|
||||
private function get_notes_requests(PageRequestEvent $event) {
|
||||
global $config;
|
||||
global $config, $database;
|
||||
|
||||
$pageNumber = $event->get_arg(1);
|
||||
|
||||
if(is_null($pageNumber) || !is_numeric($pageNumber))
|
||||
if(is_null($pageNumber) || !is_numeric($pageNumber) || $pageNumber <= 0) {
|
||||
$pageNumber = 0;
|
||||
else if ($pageNumber <= 0)
|
||||
$pageNumber = 0;
|
||||
else
|
||||
} else {
|
||||
$pageNumber--;
|
||||
}
|
||||
|
||||
$requestsPerPage = $config->get_int('notesRequestsPerPage');
|
||||
|
||||
|
||||
//$result = $database->get_all("SELECT * FROM pool_images WHERE pool_id=?", array($poolID));
|
||||
global $database;
|
||||
$get_requests = "
|
||||
SELECT DISTINCT image_id ".
|
||||
"FROM note_request ".
|
||||
"ORDER BY date DESC LIMIT ?, ?";
|
||||
|
||||
$result = $database->Execute($get_requests, array($pageNumber * $requestsPerPage, $requestsPerPage));
|
||||
|
||||
|
||||
|
||||
$result = $database->execute("
|
||||
SELECT DISTINCT image_id
|
||||
FROM note_request
|
||||
ORDER BY date DESC LIMIT ?, ?",
|
||||
array($pageNumber * $requestsPerPage, $requestsPerPage));
|
||||
|
||||
$totalPages = ceil($database->get_one("SELECT COUNT(*) FROM note_request") / $requestsPerPage);
|
||||
|
||||
|
||||
$images = array();
|
||||
while(!$result->EOF) {
|
||||
$image = Image::by_id($result->fields["image_id"]);
|
||||
$images[] = array($image);
|
||||
$result->MoveNext();
|
||||
while($row = $result->fetch()) {
|
||||
$images[] = array(Image::by_id($row["image_id"]));
|
||||
}
|
||||
|
||||
|
||||
$this->theme->display_note_requests($images, $pageNumber + 1, $totalPages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* HERE WE ADD HISTORY TO TRACK THE CHANGES OF THE NOTES FOR THE IMAGES.
|
||||
*/
|
||||
private function add_history($noteEnable, $noteID, $imageID, $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText){
|
||||
global $user, $database;
|
||||
|
||||
$userID = $user->id;
|
||||
|
||||
|
||||
$reviewID = $database->get_one("SELECT COUNT(*) FROM note_histories WHERE note_id = ?", array($noteID));
|
||||
$reviewID = $reviewID + 1;
|
||||
|
||||
|
||||
$database->execute("
|
||||
INSERT INTO note_histories
|
||||
(note_enable, note_id, review_id, image_id, user_id, user_ip, date, x1, y1, height, width, note)
|
||||
VALUES
|
||||
(?, ?, ?, ?, ?, ?, now(), ?, ?, ?, ?, ?)",
|
||||
array($noteEnable, $noteID, $reviewID, $imageID, $userID, $_SERVER['REMOTE_ADDR'], $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText));
|
||||
INSERT INTO note_histories (note_enable, note_id, review_id, image_id, user_id, user_ip, date, x1, y1, height, width, note)
|
||||
VALUES (?, ?, ?, ?, ?, ?, now(), ?, ?, ?, ?, ?)",
|
||||
array($noteEnable, $noteID, $reviewID, $imageID, $user->id, $_SERVER['REMOTE_ADDR'], $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText));
|
||||
}
|
||||
|
||||
|
||||
|
@ -507,29 +450,27 @@ class Notes extends Extension {
|
|||
* @param PageRequestEvent $event
|
||||
*/
|
||||
private function get_histories(PageRequestEvent $event){
|
||||
$pageNumber = $event->get_arg(1);
|
||||
if(is_null($pageNumber) || !is_numeric($pageNumber))
|
||||
$pageNumber = 0;
|
||||
else if ($pageNumber <= 0)
|
||||
$pageNumber = 0;
|
||||
else
|
||||
$pageNumber--;
|
||||
global $config, $database;
|
||||
|
||||
$pageNumber = $event->get_arg(1);
|
||||
if (is_null($pageNumber) || !is_numeric($pageNumber) || $pageNumber <= 0) {
|
||||
$pageNumber = 0;
|
||||
} else {
|
||||
$pageNumber--;
|
||||
}
|
||||
|
||||
$historiesPerPage = $config->get_int('notesHistoriesPerPage');
|
||||
|
||||
global $config;
|
||||
|
||||
$histiriesPerPage = $config->get_int('notesHistoriesPerPage');
|
||||
|
||||
//ORDER BY IMAGE & DATE
|
||||
global $database;
|
||||
$histories = $database->get_all("SELECT h.note_id, h.review_id, h.image_id, h.date, h.note, u.name AS user_name ".
|
||||
"FROM note_histories AS h ".
|
||||
"INNER JOIN users AS u ".
|
||||
"ON u.id = h.user_id ".
|
||||
"ORDER BY date DESC LIMIT ?, ?",
|
||||
array($pageNumber * $histiriesPerPage, $histiriesPerPage));
|
||||
|
||||
$totalPages = ceil($database->get_one("SELECT COUNT(*) FROM note_histories") / $histiriesPerPage);
|
||||
|
||||
"FROM note_histories AS h ".
|
||||
"INNER JOIN users AS u ".
|
||||
"ON u.id = h.user_id ".
|
||||
"ORDER BY date DESC LIMIT ?, ?",
|
||||
array($pageNumber * $historiesPerPage, $historiesPerPage));
|
||||
|
||||
$totalPages = ceil($database->get_one("SELECT COUNT(*) FROM note_histories") / $historiesPerPage);
|
||||
|
||||
$this->theme->display_histories($histories, $pageNumber + 1, $totalPages);
|
||||
}
|
||||
|
||||
|
@ -539,30 +480,29 @@ class Notes extends Extension {
|
|||
* @param PageRequestEvent $event
|
||||
*/
|
||||
private function get_history(PageRequestEvent $event){
|
||||
$noteID = $event->get_arg(1);
|
||||
$pageNumber = $event->get_arg(2);
|
||||
if(is_null($pageNumber) || !is_numeric($pageNumber))
|
||||
$pageNumber = 0;
|
||||
else if ($pageNumber <= 0)
|
||||
$pageNumber = 0;
|
||||
else
|
||||
$pageNumber--;
|
||||
global $config, $database;
|
||||
|
||||
$noteID = $event->get_arg(1);
|
||||
|
||||
$pageNumber = $event->get_arg(2);
|
||||
if (is_null($pageNumber) || !is_numeric($pageNumber) || $pageNumber <= 0) {
|
||||
$pageNumber = 0;
|
||||
} else {
|
||||
$pageNumber--;
|
||||
}
|
||||
|
||||
$historiesPerPage = $config->get_int('notesHistoriesPerPage');
|
||||
|
||||
global $config;
|
||||
|
||||
$histiriesPerPage = $config->get_int('notesHistoriesPerPage');
|
||||
|
||||
global $database;
|
||||
$histories = $database->get_all("SELECT h.note_id, h.review_id, h.image_id, h.date, h.note, u.name AS user_name ".
|
||||
"FROM note_histories AS h ".
|
||||
"INNER JOIN users AS u ".
|
||||
"ON u.id = h.user_id ".
|
||||
"WHERE note_id = ? ".
|
||||
"ORDER BY date DESC LIMIT ?, ?",
|
||||
array($noteID, $pageNumber * $histiriesPerPage, $histiriesPerPage));
|
||||
|
||||
$totalPages = ceil($database->get_one("SELECT COUNT(*) FROM note_histories WHERE note_id = ?", array($noteID)) / $histiriesPerPage);
|
||||
|
||||
"FROM note_histories AS h ".
|
||||
"INNER JOIN users AS u ".
|
||||
"ON u.id = h.user_id ".
|
||||
"WHERE note_id = ? ".
|
||||
"ORDER BY date DESC LIMIT ?, ?",
|
||||
array($noteID, $pageNumber * $historiesPerPage, $historiesPerPage));
|
||||
|
||||
$totalPages = ceil($database->get_one("SELECT COUNT(*) FROM note_histories WHERE note_id = ?", array($noteID)) / $historiesPerPage);
|
||||
|
||||
$this->theme->display_history($histories, $pageNumber + 1, $totalPages);
|
||||
}
|
||||
|
||||
|
@ -573,28 +513,23 @@ class Notes extends Extension {
|
|||
*/
|
||||
private function revert_history($noteID, $reviewID){
|
||||
global $database;
|
||||
|
||||
$history = $database->get_row("SELECT * FROM note_histories WHERE note_id = ? AND review_id = ?",array($noteID, $reviewID));
|
||||
|
||||
|
||||
$history = $database->get_row("SELECT * FROM note_histories WHERE note_id = ? AND review_id = ?", array($noteID, $reviewID));
|
||||
|
||||
$noteEnable = $history['note_enable'];
|
||||
$noteID = $history['note_id'];
|
||||
$imageID = $history['image_id'];
|
||||
$noteX1 = $history['x1'];
|
||||
$noteY1 = $history['y1'];
|
||||
$noteID = $history['note_id'];
|
||||
$imageID = $history['image_id'];
|
||||
$noteX1 = $history['x1'];
|
||||
$noteY1 = $history['y1'];
|
||||
$noteHeight = $history['height'];
|
||||
$noteWidth = $history['width'];
|
||||
$noteText = $history['note'];
|
||||
|
||||
$noteWidth = $history['width'];
|
||||
$noteText = $history['note'];
|
||||
|
||||
$database->execute("UPDATE notes ".
|
||||
"SET enable = ?, ".
|
||||
"x1 = ?, ".
|
||||
"y1 = ?, ".
|
||||
"height = ?, ".
|
||||
"width = ?,".
|
||||
"note = ? ".
|
||||
"WHERE image_id = ? AND id = ?", array(1, $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText, $imageID, $noteID));
|
||||
|
||||
"SET enable = ?, x1 = ?, y1 = ?, height = ?, width = ?, note = ? ".
|
||||
"WHERE image_id = ? AND id = ?",
|
||||
array(1, $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText, $imageID, $noteID));
|
||||
|
||||
$this->add_history($noteEnable, $noteID, $imageID, $noteX1, $noteY1, $noteHeight, $noteWidth, $noteText);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@ $(function() {
|
|||
if(window.notes) {
|
||||
$('#main_image').load(function(){
|
||||
$('#main_image').imgNotes({notes: window.notes});
|
||||
|
||||
//Make sure notes are always shown
|
||||
$('#main_image').off('mouseenter mouseleave');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
.note {
|
||||
display: none;
|
||||
background-color: #fffdef;
|
||||
border: #412a21 1px solid;
|
||||
display: block;
|
||||
|
||||
background-color: #FFE;
|
||||
border: 1px dashed black;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
|
@ -74,4 +75,13 @@
|
|||
}
|
||||
|
||||
.imgareaselect-selection {
|
||||
}
|
||||
}
|
||||
|
||||
/* Makes sure the note block is hidden */
|
||||
section#note_system {
|
||||
height: 0;
|
||||
}
|
||||
section#note_system > .blockbody {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class NotesTheme extends Themelet {
|
||||
public function note_button($image_id) {
|
||||
return '
|
||||
return '
|
||||
<!-- <a href="#" id="addnotelink" >Add a note</a> -->
|
||||
<form action="" method="">
|
||||
<input type="button" id="addnote" value="Add Note">
|
||||
|
@ -30,42 +30,45 @@ class NotesTheme extends Themelet {
|
|||
</form>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
public function search_notes_page(Page $page) { //IN DEVELOPMENT, NOT FULLY WORKING
|
||||
$html = '<form method="GET" action="'.make_link("post/list/note=").'">
|
||||
<input placeholder="Search Notes" type="text" name="search"/>
|
||||
<input type="submit" style="display: none;" value="Find"/>
|
||||
</form>';
|
||||
|
||||
|
||||
$page->set_title(html_escape("Search Note"));
|
||||
$page->set_heading(html_escape("Search Note"));
|
||||
$page->add_block(new Block("Search Note", $html, "main", 10));
|
||||
}
|
||||
|
||||
|
||||
// check action POST on form
|
||||
public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions)
|
||||
{
|
||||
public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions) {
|
||||
$base_href = get_base_href();
|
||||
|
||||
$page->add_html_header("<script src='$base_href/ext/notes/lib/jquery.imgnotes-1.0.min.js' type='text/javascript'></script>");
|
||||
$page->add_html_header("<script src='$base_href/ext/notes/lib/jquery.imgareaselect-1.0.0-rc1.min.js' type='text/javascript'></script>");
|
||||
$page->add_html_header("<link rel='stylesheet' type='text/css' href='$base_href/ext/notes/lib/jquery.imgnotes-1.0.min.css' />");
|
||||
|
||||
$to_json = array();
|
||||
foreach($recovered_notes as $note)
|
||||
{
|
||||
foreach($recovered_notes as $note) {
|
||||
$parsedNote = $note["note"];
|
||||
$parsedNote = str_replace("\n", "\\n", $parsedNote);
|
||||
$parsedNote = str_replace("\r", "\\r", $parsedNote);
|
||||
|
||||
$to_json[] = array(
|
||||
'x1' => $note["x1"],
|
||||
'y1' => $note["y1"],
|
||||
'height' => $note["height"],
|
||||
'width' => $note["width"],
|
||||
'note' => $parsedNote,
|
||||
'x1' => $note["x1"],
|
||||
'y1' => $note["y1"],
|
||||
'height' => $note["height"],
|
||||
'width' => $note["width"],
|
||||
'note' => $parsedNote,
|
||||
'note_id' => $note["id"],
|
||||
);
|
||||
}
|
||||
|
||||
$html = "<script type='text/javascript'>";
|
||||
$html .= "notes = " . json_encode($to_json);
|
||||
$html .= "</script>
|
||||
|
||||
$html = "<script type='text/javascript'>notes = ".json_encode($to_json)."</script>";
|
||||
|
||||
$html .= "
|
||||
<div id='noteform'>
|
||||
".make_form(make_link("note/add_note"))."
|
||||
<input type='hidden' name='image_id' value='".$image_id."' />
|
||||
|
@ -73,7 +76,7 @@ class NotesTheme extends Themelet {
|
|||
<input name='note_y1' type='hidden' value='' id='NoteY1' />
|
||||
<input name='note_height' type='hidden' value='' id='NoteHeight' />
|
||||
<input name='note_width' type='hidden' value='' id='NoteWidth' />
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
|
@ -85,7 +88,7 @@ class NotesTheme extends Themelet {
|
|||
<td><input type='button' value='Cancel' id='cancelnote' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div id='noteEditForm'>
|
||||
|
@ -124,10 +127,10 @@ class NotesTheme extends Themelet {
|
|||
|
||||
$html .= "</div>";
|
||||
|
||||
$page->add_block(new Block(null, $html, "main", 1));
|
||||
$page->add_block(new Block(null, $html, "main", 1, 'note_system'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function display_note_list($images, $pageNumber, $totalPages) {
|
||||
global $page;
|
||||
$pool_images = '';
|
||||
|
@ -137,20 +140,21 @@ class NotesTheme extends Themelet {
|
|||
$thumb_html = $this->build_thumb_html($image);
|
||||
|
||||
$pool_images .= '<span class="thumb">'.
|
||||
'<a href="$image_link">'.$thumb_html.'</a>'.
|
||||
'</span>';
|
||||
' <a href="$image_link">'.$thumb_html.'</a>'.
|
||||
'</span>';
|
||||
|
||||
|
||||
|
||||
}
|
||||
$this->display_paginator($page, "note/list", null, $pageNumber, $totalPages);
|
||||
|
||||
|
||||
$page->set_title("Notes");
|
||||
$page->set_heading("Notes");
|
||||
$page->add_block(new Block("Notes", $pool_images, "main", 20));
|
||||
}
|
||||
|
||||
|
||||
public function display_note_requests($images, $pageNumber, $totalPages) {
|
||||
global $page;
|
||||
|
||||
$pool_images = '';
|
||||
foreach($images as $pair) {
|
||||
$image = $pair[0];
|
||||
|
@ -158,13 +162,13 @@ class NotesTheme extends Themelet {
|
|||
$thumb_html = $this->build_thumb_html($image);
|
||||
|
||||
$pool_images .= '<span class="thumb">'.
|
||||
'<a href="$image_link">'.$thumb_html.'</a>'.
|
||||
'</span>';
|
||||
' <a href="$image_link">'.$thumb_html.'</a>'.
|
||||
'</span>';
|
||||
|
||||
|
||||
|
||||
}
|
||||
$this->display_paginator($page, "requests/list", null, $pageNumber, $totalPages);
|
||||
|
||||
|
||||
$page->set_title("Note Requests");
|
||||
$page->set_heading("Note Requests");
|
||||
$page->add_block(new Block("Note Requests", $pool_images, "main", 20));
|
||||
|
@ -174,19 +178,19 @@ class NotesTheme extends Themelet {
|
|||
global $user;
|
||||
|
||||
$html = "<table id='poolsList' class='zebra'>".
|
||||
"<thead><tr>".
|
||||
"<th>Image</th>".
|
||||
"<th>Note</th>".
|
||||
"<th>Body</th>".
|
||||
"<th>Updater</th>".
|
||||
"<th>Date</th>";
|
||||
"<thead><tr>".
|
||||
"<th>Image</th>".
|
||||
"<th>Note</th>".
|
||||
"<th>Body</th>".
|
||||
"<th>Updater</th>".
|
||||
"<th>Date</th>";
|
||||
|
||||
if(!$user->is_anonymous()){
|
||||
$html .= "<th>Action</th>";
|
||||
}
|
||||
|
||||
$html .= "</tr></thead>".
|
||||
"<tbody>";
|
||||
"<tbody>";
|
||||
|
||||
foreach($histories as $history) {
|
||||
$image_link = "<a href='".make_link("post/view/".$history['image_id'])."'>".$history['image_id']."</a>";
|
||||
|
@ -195,11 +199,11 @@ class NotesTheme extends Themelet {
|
|||
$revert_link = "<a href='".make_link("note/revert/".$history['note_id']."/".$history['review_id'])."'>Revert</a>";
|
||||
|
||||
$html .= "<tr>".
|
||||
"<td>".$image_link."</td>".
|
||||
"<td>".$history_link."</td>".
|
||||
"<td style='text-align:left;'>".$history['note']."</td>".
|
||||
"<td>".$user_link."</td>".
|
||||
"<td>".autodate($history['date'])."</td>";
|
||||
"<td>".$image_link."</td>".
|
||||
"<td>".$history_link."</td>".
|
||||
"<td style='text-align:left;'>".$history['note']."</td>".
|
||||
"<td>".$user_link."</td>".
|
||||
"<td>".autodate($history['date'])."</td>";
|
||||
|
||||
if(!$user->is_anonymous()){
|
||||
$html .= "<td>".$revert_link."</td>";
|
||||
|
@ -223,7 +227,7 @@ class NotesTheme extends Themelet {
|
|||
|
||||
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
|
||||
}
|
||||
|
||||
|
||||
public function display_history($histories, $pageNumber, $totalPages) {
|
||||
global $page;
|
||||
|
||||
|
@ -232,8 +236,7 @@ class NotesTheme extends Themelet {
|
|||
$page->set_title("Note History");
|
||||
$page->set_heading("Note History");
|
||||
$page->add_block(new Block("Note History", $html, "main", 10));
|
||||
|
||||
|
||||
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
|
||||
|
||||
$(function() {
|
||||
var order_pool = Cookies.get("shm_ui-order-pool") || "created";
|
||||
$("#order_pool option[value="+order_pool+"]").attr("selected", true);
|
||||
|
||||
$('#order_pool').change(function(){
|
||||
var val = $("#order_pool option:selected").val();
|
||||
Cookies.set("shm_ui-order-pool", val, {expires: 365}); //FIXME: This won't play nice if COOKIE_PREFIX is not "shm_".
|
||||
Cookies.set("shm_ui-order-pool", val, {path: '/', expires: 365}); //FIXME: This won't play nice if COOKIE_PREFIX is not "shm_".
|
||||
window.location.href = '';
|
||||
});
|
||||
});
|
||||
|
|
|
@ -86,14 +86,14 @@ class PoolsTheme extends Themelet {
|
|||
|
||||
$html .= "</tbody></table>";
|
||||
|
||||
$order_html = '
|
||||
<select id="order_pool">
|
||||
<option value="created">Recently created</option>
|
||||
<option value="updated">Last updated</option>
|
||||
<option value="name">Name</option>
|
||||
<option value="count">Post count</option>
|
||||
</select>
|
||||
';
|
||||
$order_html = '<select id="order_pool">';
|
||||
$order_selected = $page->get_cookie('ui-order-pool');
|
||||
$order_arr = ['created' => 'Recently created', 'updated' => 'Last updated', 'name' => 'Name', 'count' => 'Post Count'];
|
||||
foreach($order_arr as $value => $text) {
|
||||
$selected = ($value == $order_selected ? "selected" : "");
|
||||
$order_html .= "<option value=\"{$value}\" {$selected}>{$text}</option>\n";
|
||||
}
|
||||
$order_html .= '</select>';
|
||||
|
||||
$this->display_top(null, "Pools");
|
||||
$page->add_block(new Block("Order By", $order_html, "left", 15));
|
||||
|
|
|
@ -308,12 +308,9 @@ class Setup extends Extension {
|
|||
$sb = new SetupBlock("Remote API Integration");
|
||||
$sb->add_label("<a href='http://akismet.com/'>Akismet</a>");
|
||||
$sb->add_text_option("comment_wordpress_key", "<br>API key: ");
|
||||
$sb->add_label(
|
||||
"<br> <br><a href='".
|
||||
recaptcha_get_signup_url($_SERVER["HTTP_HOST"], "Shimmie").
|
||||
"'>ReCAPTCHA</a>");
|
||||
$sb->add_text_option("api_recaptcha_privkey", "<br>Private key: ");
|
||||
$sb->add_text_option("api_recaptcha_pubkey", "<br>Public key: ");
|
||||
$sb->add_label("<br> <br><a href='https://www.google.com/recaptcha/admin'>ReCAPTCHA</a>");
|
||||
$sb->add_text_option("api_recaptcha_privkey", "<br>Secret key: ");
|
||||
$sb->add_text_option("api_recaptcha_pubkey", "<br>Site key: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,13 +238,15 @@ class Upload extends Extension {
|
|||
* @return string[]
|
||||
*/
|
||||
private function tags_for_upload_slot($id) {
|
||||
$post_tags = isset($_POST["tags"]) ? $_POST["tags"] : "";
|
||||
|
||||
if(isset($_POST["tags$id"])) {
|
||||
# merge then explode, not explode then merge - else
|
||||
# one of the merges may create a surplus "tagme"
|
||||
$tags = Tag::explode($_POST['tags'] . " " . $_POST["tags$id"]);
|
||||
$tags = Tag::explode($post_tags . " " . $_POST["tags$id"]);
|
||||
}
|
||||
else {
|
||||
$tags = Tag::explode($_POST['tags']);
|
||||
$tags = Tag::explode($post_tags);
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
|
|
37
index.php
37
index.php
File diff suppressed because one or more lines are too long
340
install.php
340
install.php
File diff suppressed because one or more lines are too long
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project version="2">
|
||||
<!-- Output SWF options -->
|
||||
<output>
|
||||
<movie outputType="Application" />
|
||||
<movie input="" />
|
||||
<movie path="bin\JarisFLVPlayer.swf" />
|
||||
<movie fps="30" />
|
||||
<movie width="800" />
|
||||
<movie height="600" />
|
||||
<movie version="10" />
|
||||
<movie minorVersion="0" />
|
||||
<movie platform="Flash Player" />
|
||||
<movie background="#FFFFFF" />
|
||||
</output>
|
||||
<!-- Other classes to be compiled into your SWF -->
|
||||
<classpaths>
|
||||
<class path="src" />
|
||||
</classpaths>
|
||||
<!-- Build options -->
|
||||
<build>
|
||||
<option directives="" />
|
||||
<option flashStrict="False" />
|
||||
<option mainClass="jaris.Main" />
|
||||
<option enabledebug="False" />
|
||||
<option additional="" />
|
||||
</build>
|
||||
<!-- haxelib libraries -->
|
||||
<haxelib>
|
||||
<!-- example: <library name="..." /> -->
|
||||
</haxelib>
|
||||
<!-- Class files to compile (other referenced classes will automatically be included) -->
|
||||
<compileTargets>
|
||||
<compile path="src\jaris\Main.hx" />
|
||||
</compileTargets>
|
||||
<!-- Assets to embed into the output SWF -->
|
||||
<library>
|
||||
<!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
|
||||
</library>
|
||||
<!-- Paths to exclude from the Project Explorer tree -->
|
||||
<hiddenPaths>
|
||||
<!-- example: <hidden path="..." /> -->
|
||||
</hiddenPaths>
|
||||
<!-- Executed before build -->
|
||||
<preBuildCommand />
|
||||
<!-- Executed after build -->
|
||||
<postBuildCommand alwaysRun="False" />
|
||||
<!-- Other project options -->
|
||||
<options>
|
||||
<option showHiddenPaths="True" />
|
||||
<option testMovie="Default" />
|
||||
</options>
|
||||
<!-- Plugin storage -->
|
||||
<storage />
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
|
@ -1,126 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Jaris FLV Player</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="language" content="en" />
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<script src="js/swfobject.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var flashvarsVideo = {
|
||||
source: "http://jaris.sourceforge.net/files/jaris-intro.flv",
|
||||
type: "video",
|
||||
streamtype: "file",
|
||||
server: "",//Used for rtmp streams
|
||||
duration: "52",
|
||||
poster: "http://jaris.sourceforge.net/images/poster.png",
|
||||
autostart: "false",
|
||||
logo: "http://jaris.sourceforge.net/images/logo.png",
|
||||
logoposition: "top left",
|
||||
logoalpha: "30",
|
||||
logowidth: "130",
|
||||
logolink: "http://jaris.sourceforge.net",
|
||||
hardwarescaling: "false",
|
||||
darkcolor: "000000",
|
||||
brightcolor: "4c4c4c",
|
||||
controlcolor: "FFFFFF",
|
||||
hovercolor: "67A8C1"
|
||||
};
|
||||
var flashvarsVideoNewControls = {
|
||||
source: "http://jaris.sourceforge.net/files/jaris-intro.flv",
|
||||
type: "video",
|
||||
streamtype: "file",
|
||||
server: "",//Used for rtmp streams
|
||||
duration: "52",
|
||||
poster: "http://jaris.sourceforge.net/images/poster.png",
|
||||
autostart: "false",
|
||||
logo: "http://jaris.sourceforge.net/images/logo.png",
|
||||
logoposition: "top left",
|
||||
logoalpha: "30",
|
||||
logowidth: "130",
|
||||
logolink: "http://jaris.sourceforge.net",
|
||||
hardwarescaling: "false",
|
||||
darkcolor: "000000",
|
||||
brightcolor: "4c4c4c",
|
||||
controlcolor: "FFFFFF",
|
||||
hovercolor: "67A8C1",
|
||||
controltype: 1
|
||||
};
|
||||
var flashvarsAudio = {
|
||||
source: "http://jaris.sourceforge.net/files/audio.mp3",
|
||||
type: "audio",
|
||||
streamtype: "file",
|
||||
server: "",//Used for rtmp streams
|
||||
duration: "00:04:25",
|
||||
poster: "http://jaris.sourceforge.net/images/poster.png",
|
||||
autostart: "false",
|
||||
logo: "http://jaris.sourceforge.net/images/logo.png",
|
||||
logoposition: "top left",
|
||||
logoalpha: "30",
|
||||
logowidth: "130",
|
||||
logolink: "http://jaris.sourceforge.net",
|
||||
hardwarescaling: "false",
|
||||
darkcolor: "D3D3D3",
|
||||
brightcolor: "FFFFFF",
|
||||
controlcolor: "000000",
|
||||
hovercolor: "FF0000"
|
||||
};
|
||||
var params = {
|
||||
menu: "false",
|
||||
scale: "noScale",
|
||||
allowFullscreen: "true",
|
||||
allowScriptAccess: "always",
|
||||
bgcolor: "#000000",
|
||||
quality: "high",
|
||||
wmode: "opaque"
|
||||
};
|
||||
var attributes = {
|
||||
id:"JarisFLVPlayer"
|
||||
};
|
||||
swfobject.embedSWF("JarisFLVPlayer.swf", "altContentOne", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsVideo, params, attributes);
|
||||
swfobject.embedSWF("JarisFLVPlayer.swf", "altContentOneNewControls", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsVideoNewControls, params, attributes);
|
||||
swfobject.embedSWF("JarisFLVPlayer.swf", "altContentTwo", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsAudio, params, attributes);
|
||||
</script>
|
||||
<style>
|
||||
html, body { height:100%; }
|
||||
body { margin:0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<br />
|
||||
<center>
|
||||
<h1>Video Example</h1>
|
||||
<div id="altContentOne">
|
||||
<h1>Jaris FLV Player</h1>
|
||||
<p>Alternative content</p>
|
||||
<p><a href="http://www.adobe.com/go/getflashplayer"><img
|
||||
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
|
||||
alt="Get Adobe Flash player" /></a></p>
|
||||
</div>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<h1>Video Example with New Controls</h1>
|
||||
<div id="altContentOneNewControls">
|
||||
<h1>Jaris FLV Player</h1>
|
||||
<p>Alternative content</p>
|
||||
<p><a href="http://www.adobe.com/go/getflashplayer"><img
|
||||
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
|
||||
alt="Get Adobe Flash player" /></a></p>
|
||||
</div>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<h1>Audio Example</h1>
|
||||
<div id="altContentTwo">
|
||||
<h1>Jaris FLV Player</h1>
|
||||
<p>Alternative content</p>
|
||||
<p><a href="http://www.adobe.com/go/getflashplayer"><img
|
||||
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
|
||||
alt="Get Adobe Flash player" /></a></p>
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
|
@ -1,98 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson Gonzalez
|
||||
* @copyright 2010 Jefferson Gonzalez
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
*Interface for the JarisFLVPlayer JavaScript API implemented
|
||||
*by Sascha from http://projekktor.com/
|
||||
*@param id The id of the flash object
|
||||
*/
|
||||
function JarisFLVPlayer(id){
|
||||
|
||||
this.playerId = id; //Stores the id of the player
|
||||
this.player = document.getElementById(id); //Object that points to the player
|
||||
}
|
||||
|
||||
//Event constants
|
||||
JarisFLVPlayer.event = {
|
||||
MOUSE_HIDE: "onMouseHide",
|
||||
MOUSE_SHOW: "onMouseShow",
|
||||
MEDIA_INITIALIZED: "onDataInitialized",
|
||||
BUFFERING: "onBuffering",
|
||||
NOT_BUFFERING: "onNotBuffering",
|
||||
RESIZE: "onResize",
|
||||
PLAY_PAUSE: "onPlayPause",
|
||||
PLAYBACK_FINISHED: "onPlaybackFinished",
|
||||
CONNECTION_FAILED: "onConnectionFailed",
|
||||
ASPECT_RATIO: "onAspectRatio",
|
||||
VOLUME_UP: "onVolumeUp",
|
||||
VOLUME_DOWN: "onVolumeDown",
|
||||
VOLUME_CHANGE: "onVolumeChange",
|
||||
MUTE: "onMute",
|
||||
TIME: "onTimeUpdate",
|
||||
PROGRESS: "onProgress",
|
||||
SEEK: "onSeek",
|
||||
ON_ALL: "on*"
|
||||
};
|
||||
|
||||
JarisFLVPlayer.prototype.isBuffering = function(){
|
||||
return this.player.api_get("isBuffering");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.isPlaying = function(){
|
||||
return this.player.api_get("isPlaying");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.getCurrentTime = function(){
|
||||
return this.player.api_get("time");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.getBytesLoaded = function(){
|
||||
return this.player.api_get("loaded");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.getVolume = function(){
|
||||
return this.player.api_get("volume");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.addListener = function(event, listener){
|
||||
this.player.api_addlistener(event, listener);
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.removeListener = function(event){
|
||||
this.player.api_removelistener(event);
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.play = function(){
|
||||
this.player.api_play();
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.pause = function(){
|
||||
this.player.api_pause();
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.seek = function(seconds){
|
||||
this.player.api_seek(seconds);
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.volume = function(value){
|
||||
this.player.api_volume(value);
|
||||
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 87 KiB |
|
@ -1,118 +0,0 @@
|
|||
Jaris FLV Player v2.0.15 beta - 27/08/2011
|
||||
|
||||
* New player controls
|
||||
* New flashvar controltype (0=old, 1=new) to indicate the which controls to use
|
||||
* New flashvar controlsize for new controls only
|
||||
* New flashvar seekcolor for new controls only
|
||||
* New flashvar buffertime to change the default 10 seconds buffer time for local/pseudo streaming
|
||||
* Bugfix on loader bar
|
||||
* All this changes thanks to Istvan Petres from http://jcore.net
|
||||
|
||||
Jaris FLV Player v2.0.14 beta - 20/05/2011
|
||||
|
||||
* Removed some trace calls on youtube playback.
|
||||
|
||||
Jaris FLV Player v2.0.13 beta - 6/03/2011
|
||||
|
||||
* Implemented loop class
|
||||
* Added loop functionality by passing loop=true or loop=1 as parameter
|
||||
* Fixed reported bug "slider will show wrong position" on pseudostreaming seek (Thanks to Adam)
|
||||
|
||||
Jaris FLV Player v2.0.12 beta - 06/11/2010
|
||||
|
||||
* Java Script Api to listen for events and control the player.
|
||||
* More player events added to use on JSApi.
|
||||
* All this changes thanks to Sascha Kluger from http://projekktor.com
|
||||
|
||||
Jaris FLV Player v2.0.11 beta - 03/10/2010
|
||||
|
||||
* Removed togglePlay of onFullscreen event since it seems that new flash versions doesnt emits
|
||||
the space keydown anymore that affected playback on fullcreen switching.
|
||||
* Added class to store user settings as volume and aspect ratio to load them next time player is load.
|
||||
|
||||
Jaris FLV Player v2.0.10 beta - 29/09/2010
|
||||
|
||||
* Added flashvar aspectratio option to initially tell on wich aspect ratio to play the video
|
||||
|
||||
Jaris FLV Player v2.0.9 beta - 26/05/2010
|
||||
|
||||
* Improved poster to keep aspect ratio and display back when playback finishes
|
||||
|
||||
Jaris FLV Player v2.0.8 beta - 14/05/2010
|
||||
|
||||
* Fixed bug on formatTime function calculating hours as minutes
|
||||
|
||||
Jaris FLV Player v2.0.7 beta - 03/19/2010
|
||||
|
||||
* Fixed youtube security bug
|
||||
|
||||
Jaris FLV Player v2.0.6 beta - 03/13/2010
|
||||
|
||||
* Added: display current aspect ratio label on aspect ratio toggle
|
||||
* Improved readability of text
|
||||
* only attach netstream to video object if input type is video
|
||||
* remove poster from player code
|
||||
|
||||
Jaris FLV Player v2.0.5 beta - 03/12/2010
|
||||
|
||||
* Improved aspect ratio toogle when video aspect ratio is already on the aspect ratios list
|
||||
* Fixed context menu aspect ratio rotation
|
||||
|
||||
Jaris FLV Player v2.0.4 beta - 03/11/2010
|
||||
|
||||
* Fixed a drawing issue where seek bar after fullscreen stayed long
|
||||
* Documented other parts of the code
|
||||
|
||||
Jaris FLV Player v2.0.3 beta - 03/10/2010
|
||||
|
||||
* Support for rtmp streaming
|
||||
* support for youtube
|
||||
* better support for http streaming like lighttpd
|
||||
* Fixed calculation of width on original aspect ratio larger than stage
|
||||
* And many hours of improvements
|
||||
|
||||
Jaris FLV Player v2.0.2 beta - 03/09/2010
|
||||
|
||||
* Implement EventDispatcher on Player class instead of using custom event mechanism
|
||||
* Fixed not getting initial stage widht and height on IE when using swfobjects
|
||||
* Some more improvements to controls on short heights
|
||||
* Other improvements and code refactoring
|
||||
* added id3 info to player events
|
||||
|
||||
Jaris FLV Player v2.0.1 beta - 03/08/2010
|
||||
|
||||
* Toggle Quality on Context Menu
|
||||
* Introduction of type parameter
|
||||
* Initial mp3 support
|
||||
* Loader fixes
|
||||
* Controls fixes
|
||||
* Other refinements and fixes
|
||||
* Duration parameter to indicate how much total time takes input media
|
||||
|
||||
Jaris FLV Player v2.0.0 beta - 03/05/2010
|
||||
|
||||
* Moved from swishmax 2 to haxe and flashdevelop
|
||||
* New GUI completely written in haxe (AS3)
|
||||
* Hide controls on fullscreen
|
||||
* Recalculate aspect ratio on fullscreen.
|
||||
* Redraw controls on fullscreen and normal switching.
|
||||
* Initial pseudo streaming support
|
||||
* Compiled to flash 10
|
||||
* Now uses as3 libraries
|
||||
* Optional Hardware scaling
|
||||
* Video smoothing enabled by default
|
||||
* Added custom context menu
|
||||
* Other refinements and fixes
|
||||
|
||||
Jaris FLV Player v1.0 - 05/21/2008
|
||||
|
||||
* Calculates video aspect ratio on player load.
|
||||
* Support Flash 9 Stage.displayState (Fullscreen mode).
|
||||
* Support for preview image of the video.
|
||||
* Display buffering message.
|
||||
* Internal volume control.
|
||||
* Back and forward control.
|
||||
* Display the actual playing time and total time.
|
||||
* Support for logo image on the fly.
|
||||
* Flag to autostart the video on player load.
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
==================
|
||||
How To!
|
||||
==================
|
||||
|
||||
The above example is one of the ways to embed the player to your html files. Just copy and paste.
|
||||
|
||||
---------------------------------------Code------------------------------------------
|
||||
<object
|
||||
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
|
||||
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,45,2"
|
||||
width="640" height="360"
|
||||
>
|
||||
<param name="allowFullscreen" value="true">
|
||||
<param name="allowScriptAccess" value="always">
|
||||
<param name="movie" value="JarisFLVPlayer.swf">
|
||||
<param name="bgcolor" value="#000000">
|
||||
<param name="quality" value="high">
|
||||
<param name="scale" value="noscale">
|
||||
<param name="wmode" value="opaque">
|
||||
<param name="flashvars" value="source=jaris-intro.mp4&type=video&streamtype=file&poster=poster.png&autostart=false&logo=logo.png&logoposition=top left&logoalpha=30&logowidth=130&logolink=http://jaris.sourceforge.net&hardwarescaling=false&darkcolor=000000&brightcolor=4c4c4c&controlcolor=FFFFFF&hovercolor=67A8C1">
|
||||
<param name="seamlesstabbing" value="false">
|
||||
<embed
|
||||
type="application/x-shockwave-flash"
|
||||
pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
|
||||
width="640" height="360"
|
||||
src="JarisFLVPlayer.swf"
|
||||
allowfullscreen="true"
|
||||
allowscriptaccess="always"
|
||||
bgcolor="#000000"
|
||||
quality="high"
|
||||
scale="noscale"
|
||||
wmode="opaque"
|
||||
flashvars="source=jaris-intro.mp4&type=video&streamtype=file&poster=poster.png&autostart=false&logo=logo.png&logoposition=top left&logoalpha=30&logowidth=130&logolink=http://jaris.sourceforge.net&hardwarescaling=false&darkcolor=000000&brightcolor=4c4c4c&controlcolor=FFFFFF&hovercolor=67A8C1"
|
||||
seamlesstabbing="false"
|
||||
>
|
||||
<noembed>
|
||||
</noembed>
|
||||
</embed>
|
||||
</object>
|
||||
--------------------------------------End-Code---------------------------------------
|
||||
|
||||
==================
|
||||
Flash Variables
|
||||
==================
|
||||
|
||||
Here is the list of variables that you can pass to the player.
|
||||
|
||||
* source:
|
||||
This is the actual path of the media that is going to be played.
|
||||
|
||||
* type:
|
||||
The type of file to play, allowable values are: audio, video.
|
||||
|
||||
* streamtype:
|
||||
The stream type of the file, allowable values are: file, http, rmtp, youtube.
|
||||
|
||||
* server:
|
||||
Used in coordination with rtmp stream servers
|
||||
|
||||
* duration:
|
||||
Total times in seconds for input media or formatted string in the format hh:mm:ss
|
||||
|
||||
* poster:
|
||||
Screenshot of the video that is displayed before playing in png, jpg or gif format.
|
||||
|
||||
* autostart:
|
||||
A true or false value that indicates to the player if it should auto play the video on load.
|
||||
|
||||
* logo:
|
||||
The path to the image of your logo.
|
||||
|
||||
* logoposition:
|
||||
The position of the logo in the player, permitted values are: top left, top right, bottom left and bottom right
|
||||
|
||||
* logoalpha:
|
||||
The transparency percent. values permitted 0 to 100, while more higher the vale less transparency is applied.
|
||||
|
||||
* logowidth:
|
||||
The width in pixels of the logo.
|
||||
|
||||
* logolink:
|
||||
A link to a webpage when the logo is clicked.
|
||||
|
||||
* hardwarescaling:
|
||||
Enable or disable hardware scaling on fullscreen mode, values: false or true
|
||||
|
||||
* logoalpha:
|
||||
The transparency percent. values permitted 1 to 100
|
||||
|
||||
* controls:
|
||||
To disable the displaying of controls, values: false to hide otherwise defaults to show
|
||||
|
||||
* controltype
|
||||
Choose which controls to displa. 0 = old controls, 1 = new controls
|
||||
|
||||
* controlsize
|
||||
Changes the height of the new controllers, the default value is 40
|
||||
|
||||
* seekcolor
|
||||
Change the seekbar color (new controls only)
|
||||
|
||||
* darkcolor:
|
||||
The darker color of player controls in html hexadecimal format
|
||||
|
||||
* brightcolor:
|
||||
The bright color of player controls in html hexadecimal format
|
||||
|
||||
* controlcolor:
|
||||
The face color of controls in html hexadecimal format
|
||||
|
||||
* hovercolor:
|
||||
On mouse hover color for controls in html hexadecimal format
|
||||
|
||||
* aspectratio:
|
||||
To override original aspect ratio on first time player load. Allowable values: 1:1, 3:2, 4:3, 5:4, 14:9, 14:10, 16:9, 16:10
|
||||
|
||||
* jsapi:
|
||||
Expose events to javascript functions and enable controlling the player from the outside. Set to any value to enable.
|
||||
|
||||
* loop:
|
||||
As the variable says this keeps looping the video. Set to any value to enable.
|
||||
|
||||
* buffertime
|
||||
To change the default 10 seconds buffer time for local/pseudo streaming
|
||||
|
||||
==================
|
||||
Keyboard Shortcuts
|
||||
==================
|
||||
|
||||
Here is the list of keyboard shortcuts to control Jaris Player.
|
||||
|
||||
* SPACE
|
||||
Play or pause video.
|
||||
|
||||
* TAB
|
||||
Switch between different aspect ratios.
|
||||
|
||||
* UP
|
||||
Raise volume
|
||||
|
||||
* DOWN
|
||||
Lower volume
|
||||
|
||||
* LEFT
|
||||
Rewind
|
||||
|
||||
* RIGHT
|
||||
Forward
|
||||
|
||||
* M
|
||||
Mute or unmute volume.
|
||||
|
||||
* F
|
||||
Swtich to fullscreen mode.
|
||||
|
||||
* X
|
||||
Stops and close current stream
|
|
@ -1,789 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
|
@ -1,52 +0,0 @@
|
|||
==================
|
||||
Jaris FLV Player
|
||||
==================
|
||||
A flash flv player made using haxe and flash develop that can be embedded into any website
|
||||
for free or commercial use.
|
||||
|
||||
Web Page: http://jaris.sourceforge.net/
|
||||
Project Page: https://sourceforge.net/projects/jaris/
|
||||
|
||||
==================
|
||||
Be Free!
|
||||
==================
|
||||
|
||||
Searching for an flv player that could be used freely in all aspects and open source was
|
||||
a hard job. So I just decided to work on a basic player that had the most important
|
||||
features found in others players.
|
||||
|
||||
Thats the story of how Jaris was born.
|
||||
|
||||
==================
|
||||
Features
|
||||
==================
|
||||
|
||||
|
||||
* Aspect ratio switcher
|
||||
* Fullscreen support
|
||||
* Http pseudostreaming support
|
||||
* Poster image
|
||||
* Volume control
|
||||
* Seek control
|
||||
* Display time
|
||||
* Use your own logo
|
||||
* Add a link to your logo
|
||||
* Change position of logo
|
||||
* Hide controls on fullscreen
|
||||
* Custom control colors
|
||||
* Hardware scaling
|
||||
* Keyboard shortcuts
|
||||
* Mp3 support
|
||||
|
||||
|
||||
==================
|
||||
License
|
||||
==================
|
||||
|
||||
Jaris is licensed under GPL and LGPL, meaning that you could use it commercially.
|
||||
What we ask for is that any improvements made to the player should be taken back to jaris flv website
|
||||
so that any one could enjoy the new improvements or features also. In this way everyone could
|
||||
help to maintain an up to date tool that adapts to todays multimedia demands.
|
||||
Using sourceforge.net you could send a patch http://sourceforge.net/projects/jaris/.
|
||||
|
||||
Enjoy a totally free player ;-)
|
|
@ -1,204 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package jaris;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Stage;
|
||||
import flash.display.StageAlign;
|
||||
import flash.display.StageScaleMode;
|
||||
import flash.Lib;
|
||||
import flash.system.Capabilities;
|
||||
import jaris.display.Logo;
|
||||
import jaris.display.Menu;
|
||||
import jaris.display.Poster;
|
||||
import jaris.player.controls.Controls;
|
||||
import jaris.player.newcontrols.NewControls;
|
||||
import jaris.player.JsApi;
|
||||
import jaris.player.InputType;
|
||||
import jaris.player.Player;
|
||||
import jaris.player.StreamType;
|
||||
import jaris.player.AspectRatio;
|
||||
import jaris.player.UserSettings;
|
||||
import jaris.player.Loop;
|
||||
|
||||
/**
|
||||
* Main jaris player starting point
|
||||
*/
|
||||
class Main
|
||||
{
|
||||
static var stage:Stage;
|
||||
static var movieClip:MovieClip;
|
||||
|
||||
static function main():Void
|
||||
{
|
||||
//Initialize stage and main movie clip
|
||||
stage = Lib.current.stage;
|
||||
movieClip = Lib.current;
|
||||
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
stage.align = StageAlign.TOP_LEFT;
|
||||
|
||||
//Retrieve user settings
|
||||
var userSettings:UserSettings = new UserSettings();
|
||||
|
||||
//Reads flash vars
|
||||
var parameters:Dynamic<String> = flash.Lib.current.loaderInfo.parameters;
|
||||
|
||||
//Initialize and draw player object
|
||||
var player:Player = new Player();
|
||||
if (Capabilities.playerType == "PlugIn" || Capabilities.playerType == "ActiveX")
|
||||
{
|
||||
var autoStart:Bool = parameters.autostart == "true" || parameters.autostart == "" || parameters.autostart == null? true: false;
|
||||
var type:String = parameters.type != "" && parameters.type != null? parameters.type : InputType.VIDEO;
|
||||
var streamType:String = parameters.streamtype != "" && parameters.streamtype != null? parameters.streamtype : StreamType.FILE;
|
||||
var server:String = parameters.server != "" && parameters.server != null? parameters.server : "";
|
||||
var aspectRatio:String = parameters.aspectratio != "" && parameters.aspectratio != null? parameters.aspectratio : "";
|
||||
var bufferTime:Float = parameters.buffertime != "" && parameters.buffertime != null? Std.parseFloat(parameters.buffertime) : 0;
|
||||
|
||||
if (aspectRatio != "" && !userSettings.isSet("aspectratio"))
|
||||
{
|
||||
switch(aspectRatio)
|
||||
{
|
||||
case "1:1":
|
||||
player.setAspectRatio(AspectRatio._1_1);
|
||||
case "3:2":
|
||||
player.setAspectRatio(AspectRatio._3_2);
|
||||
case "4:3":
|
||||
player.setAspectRatio(AspectRatio._4_3);
|
||||
case "5:4":
|
||||
player.setAspectRatio(AspectRatio._5_4);
|
||||
case "14:9":
|
||||
player.setAspectRatio(AspectRatio._14_9);
|
||||
case "14:10":
|
||||
player.setAspectRatio(AspectRatio._14_10);
|
||||
case "16:9":
|
||||
player.setAspectRatio(AspectRatio._16_9);
|
||||
case "16:10":
|
||||
player.setAspectRatio(AspectRatio._16_10);
|
||||
}
|
||||
}
|
||||
else if(userSettings.isSet("aspectratio"))
|
||||
{
|
||||
player.setAspectRatio(userSettings.getAspectRatio());
|
||||
}
|
||||
|
||||
player.setType(type);
|
||||
player.setStreamType(streamType);
|
||||
player.setServer(server);
|
||||
player.setVolume(userSettings.getVolume());
|
||||
player.setBufferTime(bufferTime);
|
||||
|
||||
if (autoStart)
|
||||
{
|
||||
player.load(parameters.source, type, streamType, server);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setSource(parameters.source);
|
||||
}
|
||||
|
||||
player.setHardwareScaling(parameters.hardwarescaling=="true"?true:false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//For development purposes
|
||||
if(userSettings.isSet("aspectratio"))
|
||||
{
|
||||
player.setAspectRatio(userSettings.getAspectRatio());
|
||||
}
|
||||
|
||||
player.setVolume(userSettings.getVolume());
|
||||
|
||||
player.load("http://jaris.sourceforge.net/files/jaris-intro.flv", InputType.VIDEO, StreamType.FILE);
|
||||
//player.load("http://jaris.sourceforge.net/files/audio.mp3", InputType.AUDIO, StreamType.FILE);
|
||||
}
|
||||
|
||||
//Draw preview image
|
||||
if (parameters.poster != null)
|
||||
{
|
||||
var poster:String = parameters.poster;
|
||||
var posterImage = new Poster(poster);
|
||||
posterImage.setPlayer(player);
|
||||
movieClip.addChild(posterImage);
|
||||
}
|
||||
|
||||
//Modify Context Menu
|
||||
var menu:Menu = new Menu(player);
|
||||
|
||||
//Draw logo
|
||||
if (parameters.logo!=null)
|
||||
{
|
||||
var logoSource:String = parameters.logo != null ? parameters.logo : "logo.png";
|
||||
var logoPosition:String = parameters.logoposition != null ? parameters.logoposition : "top left";
|
||||
var logoAlpha:Float = parameters.logoalpha != null ? Std.parseFloat(parameters.logoalpha) / 100 : 0.3;
|
||||
var logoWidth:Float = parameters.logowidth != null ? Std.parseFloat(parameters.logowidth) : 130;
|
||||
var logoLink:String = parameters.logolink != null ? parameters.logolink : "http://jaris.sourceforge.net";
|
||||
|
||||
var logo:Logo = new Logo(logoSource, logoPosition, logoAlpha, logoWidth);
|
||||
logo.setLink(logoLink);
|
||||
movieClip.addChild(logo);
|
||||
}
|
||||
|
||||
//Draw Controls
|
||||
if (parameters.controls != "false")
|
||||
{
|
||||
var duration:String = parameters.duration != "" && parameters.duration != null? parameters.duration : "0";
|
||||
var controlType:Int = parameters.controltype != "" && parameters.controltype != null? Std.parseInt(parameters.controltype) : 0;
|
||||
var controlSize:Int = parameters.controlsize != "" && parameters.controlsize != null? Std.parseInt(parameters.controlsize) : 0;
|
||||
|
||||
var controlColors:Array <String> = ["", "", "", "", ""];
|
||||
controlColors[0] = parameters.darkcolor != null ? parameters.darkcolor : "";
|
||||
controlColors[1] = parameters.brightcolor != null ? parameters.brightcolor : "";
|
||||
controlColors[2] = parameters.controlcolor != null ? parameters.controlcolor : "";
|
||||
controlColors[3] = parameters.hovercolor != null ? parameters.hovercolor : "";
|
||||
controlColors[4] = parameters.seekcolor != null ? parameters.seekcolor : "";
|
||||
|
||||
if (controlType == 1) {
|
||||
var controls:NewControls = new NewControls(player);
|
||||
controls.setDurationLabel(duration);
|
||||
controls.setControlColors(controlColors);
|
||||
controls.setControlSize(controlSize);
|
||||
movieClip.addChild(controls);
|
||||
} else {
|
||||
var controls:Controls = new Controls(player);
|
||||
controls.setDurationLabel(duration);
|
||||
controls.setControlColors(controlColors);
|
||||
movieClip.addChild(controls);
|
||||
}
|
||||
}
|
||||
|
||||
//Loop the video
|
||||
if (parameters.loop != null)
|
||||
{
|
||||
var loop:Loop = new Loop(player);
|
||||
}
|
||||
|
||||
//Expose events to javascript functions and enable controlling the player from the outside
|
||||
if (parameters.jsapi != null)
|
||||
{
|
||||
var jsAPI:JsApi = new JsApi(player);
|
||||
movieClip.addChild(jsAPI);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris;
|
||||
|
||||
/**
|
||||
* Actual jaris flv player version and date
|
||||
*/
|
||||
class Version
|
||||
{
|
||||
public static var NUMBER:String = "2.0.15";
|
||||
public static var STATUS:String = "beta";
|
||||
public static var DATE:String = "27";
|
||||
public static var MONTH:String = "08";
|
||||
public static var YEAR:String = "2011";
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.animation;
|
||||
|
||||
/**
|
||||
* Gives quick access usage to jaris animations
|
||||
*/
|
||||
class Animation
|
||||
{
|
||||
|
||||
/**
|
||||
* Quick access to fade in effect
|
||||
* @param object the object to animate
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function fadeIn(object:Dynamic, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.fadeIn(object, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to fade out effect
|
||||
* @param object the object to animate
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function fadeOut(object:Dynamic, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.fadeOut(object, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to slide in effect
|
||||
* @param object the object to animate
|
||||
* @param position could be top, left, bottom or right
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function slideIn(object:Dynamic, position:String, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.slideIn(object, position, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to slide out effect
|
||||
* @param object the object to animate
|
||||
* @param position could be top, left, bottom or right
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function slideOut(object:Dynamic, position:String, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.slideOut(object, position, seconds);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,306 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.animation;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Stage;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.Lib;
|
||||
import flash.utils.Timer;
|
||||
|
||||
/**
|
||||
* Jaris main animations
|
||||
*/
|
||||
class AnimationsBase
|
||||
{
|
||||
private var _fadeInTimer:Timer;
|
||||
private var _fadeOutTimer:Timer;
|
||||
|
||||
private var _slideInTimer:Timer;
|
||||
private var _slideInOrigX:Float;
|
||||
private var _slideInOrigY:Float;
|
||||
private var _slideInPosition:String;
|
||||
private var _slideInIncrements:Float;
|
||||
|
||||
private var _slideOutTimer:Timer;
|
||||
private var _slideOutOrigX:Float;
|
||||
private var _slideOutOrigY:Float;
|
||||
private var _slideOutPosition:String;
|
||||
private var _slideOutIncrements:Float;
|
||||
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
|
||||
|
||||
private var _currentObject:Dynamic;
|
||||
|
||||
public function new()
|
||||
{
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an object until is shown
|
||||
* @param event
|
||||
*/
|
||||
private function slideInTimer(event:TimerEvent):Void
|
||||
{
|
||||
var last:Bool = false;
|
||||
switch(_slideInPosition)
|
||||
{
|
||||
case "top":
|
||||
if (_currentObject.y >= _slideInOrigY) { last = true; }
|
||||
_currentObject.y += _slideInIncrements;
|
||||
|
||||
case "left":
|
||||
if (_currentObject.x >= _slideInOrigX) { last = true; }
|
||||
_currentObject.x += _slideInIncrements;
|
||||
|
||||
case "bottom":
|
||||
if (_currentObject.y <= _slideInOrigY) { last = true; }
|
||||
_currentObject.y -= _slideInIncrements;
|
||||
|
||||
case "right":
|
||||
if (_currentObject.x <= _slideInOrigX) { last = true; }
|
||||
_currentObject.x -= _slideInIncrements;
|
||||
}
|
||||
|
||||
if (last)
|
||||
{
|
||||
_currentObject.x = _slideInOrigX;
|
||||
_currentObject.y = _slideInOrigY;
|
||||
_slideInTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an object until is hidden
|
||||
* @param event
|
||||
*/
|
||||
private function slideOutTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (((_currentObject.x + _currentObject.width) < 0) || (_currentObject.y + _currentObject.height < 0))
|
||||
{
|
||||
_currentObject.visible = false;
|
||||
_currentObject.x = _slideOutOrigX;
|
||||
_currentObject.y = _slideOutOrigY;
|
||||
|
||||
_slideOutTimer.stop();
|
||||
}
|
||||
else if (((_currentObject.x) > _stage.stageWidth) || (_currentObject.y > _stage.stageHeight))
|
||||
{
|
||||
_currentObject.visible = false;
|
||||
_currentObject.x = _slideOutOrigX;
|
||||
_currentObject.y = _slideOutOrigY;
|
||||
|
||||
_slideOutTimer.stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(_slideOutPosition)
|
||||
{
|
||||
case "top":
|
||||
_currentObject.y -= _slideOutIncrements;
|
||||
|
||||
case "left":
|
||||
_currentObject.x -= _slideOutIncrements;
|
||||
|
||||
case "bottom":
|
||||
_currentObject.y += _slideOutIncrements;
|
||||
|
||||
case "right":
|
||||
_currentObject.x += _slideOutIncrements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower object transparency until not visible
|
||||
* @param event
|
||||
*/
|
||||
private function fadeOutTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_currentObject.alpha > 0)
|
||||
{
|
||||
_currentObject.alpha -= 1 / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentObject.visible = false;
|
||||
_fadeOutTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Highers object transparency until visible
|
||||
* @param event
|
||||
*/
|
||||
private function fadeInTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_currentObject.alpha < 1)
|
||||
{
|
||||
_currentObject.alpha += 1 / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fadeInTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that moves an object into stage
|
||||
* @param object the element to move
|
||||
* @param slidePosition could be top, left bottom or right
|
||||
* @param speed the time in seconds for duration of the animation
|
||||
*/
|
||||
public function slideIn(object:Dynamic, slidePosition:String, speed:Float=1000):Void
|
||||
{
|
||||
if (object.visible)
|
||||
{
|
||||
object.visible = false;
|
||||
}
|
||||
|
||||
_slideInOrigX = object.x;
|
||||
_slideInOrigY = object.y;
|
||||
_slideInPosition = slidePosition;
|
||||
|
||||
var increments:Float = 0;
|
||||
|
||||
switch(slidePosition)
|
||||
{
|
||||
case "top":
|
||||
object.y = 0 - object.height;
|
||||
increments = object.height + _slideInOrigY;
|
||||
|
||||
case "left":
|
||||
object.x = 0 - object.width;
|
||||
increments = object.width + _slideInOrigX;
|
||||
|
||||
case "bottom":
|
||||
object.y = _stage.stageHeight;
|
||||
increments = _stage.stageHeight - _slideInOrigY;
|
||||
|
||||
case "right":
|
||||
object.x = _stage.stageWidth;
|
||||
increments = _stage.stageWidth - _slideInOrigX;
|
||||
}
|
||||
|
||||
_slideInIncrements = increments / (speed / 100);
|
||||
|
||||
_currentObject = object;
|
||||
_currentObject.visible = true;
|
||||
_currentObject.alpha = 1;
|
||||
|
||||
_slideInTimer = new Timer(speed / 100);
|
||||
_slideInTimer.addEventListener(TimerEvent.TIMER, slideInTimer);
|
||||
_slideInTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that moves an object out of stage
|
||||
* @param object the element to move
|
||||
* @param slidePosition could be top, left bottom or right
|
||||
* @param speed the time in seconds for duration of the animation
|
||||
*/
|
||||
public function slideOut(object:Dynamic, slidePosition:String, speed:Float=1000):Void
|
||||
{
|
||||
if (!object.visible)
|
||||
{
|
||||
object.visible = true;
|
||||
}
|
||||
|
||||
_slideOutOrigX = object.x;
|
||||
_slideOutOrigY = object.y;
|
||||
_slideOutPosition = slidePosition;
|
||||
|
||||
var increments:Float = 0;
|
||||
|
||||
switch(slidePosition)
|
||||
{
|
||||
case "top":
|
||||
increments = object.height + _slideOutOrigY;
|
||||
|
||||
case "left":
|
||||
increments = object.width + _slideOutOrigX;
|
||||
|
||||
case "bottom":
|
||||
increments = _stage.stageHeight - _slideOutOrigY;
|
||||
|
||||
case "right":
|
||||
increments = _stage.stageWidth - _slideOutOrigX;
|
||||
}
|
||||
|
||||
_slideOutIncrements = increments / (speed / 100);
|
||||
|
||||
_currentObject = object;
|
||||
_currentObject.visible = true;
|
||||
_currentObject.alpha = 1;
|
||||
|
||||
_slideOutTimer = new Timer(speed / 100);
|
||||
_slideOutTimer.addEventListener(TimerEvent.TIMER, slideOutTimer);
|
||||
_slideOutTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that dissapears an object from stage
|
||||
* @param object the element to dissapear
|
||||
* @param speed the time in seconds for the duration of the animation
|
||||
*/
|
||||
public function fadeOut(object:Dynamic, speed:Float=500):Void
|
||||
{
|
||||
if (!object.visible)
|
||||
{
|
||||
object.visible = true;
|
||||
}
|
||||
|
||||
object.alpha = 1;
|
||||
_currentObject = object;
|
||||
|
||||
_fadeOutTimer = new Timer(speed / 10);
|
||||
_fadeOutTimer.addEventListener(TimerEvent.TIMER, fadeOutTimer);
|
||||
_fadeOutTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that shows a hidden object an in stage
|
||||
* @param object the element to show
|
||||
* @param speed the time in seconds for the duration of the animation
|
||||
*/
|
||||
public function fadeIn(object:Dynamic, speed:Float=500):Void
|
||||
{
|
||||
if (object.visible)
|
||||
{
|
||||
object.visible = false;
|
||||
}
|
||||
|
||||
object.alpha = 0;
|
||||
_currentObject = object;
|
||||
_currentObject.visible = true;
|
||||
|
||||
_fadeInTimer = new Timer(speed / 10);
|
||||
_fadeInTimer.addEventListener(TimerEvent.TIMER, fadeInTimer);
|
||||
_fadeInTimer.start();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.display;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.Lib;
|
||||
|
||||
/**
|
||||
* Draws a loading bar
|
||||
*/
|
||||
class Loader extends Sprite
|
||||
{
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _background:Sprite;
|
||||
private var _loaderTrack:Sprite;
|
||||
private var _loaderThumb:Sprite;
|
||||
private var _visible:Bool;
|
||||
private var _brightColor:UInt;
|
||||
private var _controlColor:UInt;
|
||||
private var _forward:Bool;
|
||||
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
|
||||
_background = new Sprite();
|
||||
addChild(_background);
|
||||
|
||||
_loaderTrack = new Sprite();
|
||||
addChild(_loaderTrack);
|
||||
|
||||
_loaderThumb = new Sprite();
|
||||
addChild(_loaderThumb);
|
||||
|
||||
_brightColor = 0x4c4c4c;
|
||||
_controlColor = 0xFFFFFF;
|
||||
|
||||
_forward = true;
|
||||
_visible = true;
|
||||
|
||||
addEventListener(Event.ENTER_FRAME, onEnterFrame);
|
||||
_stage.addEventListener(Event.RESIZE, onResize);
|
||||
|
||||
drawLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Animation of a thumb moving on the track
|
||||
* @param event
|
||||
*/
|
||||
private function onEnterFrame(event:Event):Void
|
||||
{
|
||||
if (_visible)
|
||||
{
|
||||
if (_forward)
|
||||
{
|
||||
if ((_loaderThumb.x + _loaderThumb.width) >= (_loaderTrack.x + _loaderTrack.width))
|
||||
{
|
||||
_forward = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loaderThumb.x += 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_loaderThumb.x <= _loaderTrack.x)
|
||||
{
|
||||
_forward = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loaderThumb.x -= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraws the loader to match new stage size
|
||||
* @param event
|
||||
*/
|
||||
private function onResize(event:Event):Void
|
||||
{
|
||||
drawLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw loader graphics
|
||||
*/
|
||||
private function drawLoader():Void
|
||||
{
|
||||
//Clear graphics
|
||||
_background.graphics.clear();
|
||||
_loaderTrack.graphics.clear();
|
||||
_loaderThumb.graphics.clear();
|
||||
|
||||
//Draw background
|
||||
var backgroundWidth:Float = (65 / 100) * _stage.stageWidth;
|
||||
var backgroundHeight:Float = 30;
|
||||
_background.x = (_stage.stageWidth / 2) - (backgroundWidth / 2);
|
||||
_background.y = (_stage.stageHeight / 2) - (backgroundHeight / 2);
|
||||
_background.graphics.lineStyle();
|
||||
_background.graphics.beginFill(_brightColor, 0.5);
|
||||
_background.graphics.drawRoundRect(0, 0, backgroundWidth, backgroundHeight, 6, 6);
|
||||
_background.graphics.endFill();
|
||||
|
||||
//Draw track
|
||||
var trackWidth:Float = (50 / 100) * _stage.stageWidth;
|
||||
var trackHeight:Float = 15;
|
||||
_loaderTrack.x = (_stage.stageWidth / 2) - (trackWidth / 2);
|
||||
_loaderTrack.y = (_stage.stageHeight / 2) - (trackHeight / 2);
|
||||
_loaderTrack.graphics.lineStyle(2, _controlColor);
|
||||
_loaderTrack.graphics.drawRect(0, 0, trackWidth, trackHeight);
|
||||
|
||||
//Draw thumb
|
||||
_loaderThumb.x = _loaderTrack.x;
|
||||
_loaderThumb.y = _loaderTrack.y;
|
||||
_loaderThumb.graphics.lineStyle();
|
||||
_loaderThumb.graphics.beginFill(_controlColor, 1);
|
||||
_loaderThumb.graphics.drawRect(0, 0, trackHeight, trackHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops drawing the loader
|
||||
*/
|
||||
public function hide():Void
|
||||
{
|
||||
this.visible = false;
|
||||
_visible = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts drawing the loader
|
||||
*/
|
||||
public function show():Void
|
||||
{
|
||||
this.visible = true;
|
||||
_visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set loader colors
|
||||
* @param colors
|
||||
*/
|
||||
public function setColors(colors:Array<String>):Void
|
||||
{
|
||||
_brightColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x4c4c4c;
|
||||
_controlColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0xFFFFFF;
|
||||
|
||||
drawLoader();
|
||||
}
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.display;
|
||||
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.Lib;
|
||||
import flash.net.URLRequest;
|
||||
|
||||
/**
|
||||
* To display an image in jpg, png or gif format as logo
|
||||
*/
|
||||
class Logo extends Sprite
|
||||
{
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _loader:Loader;
|
||||
private var _position:String;
|
||||
private var _alpha:Float;
|
||||
private var _source:String;
|
||||
private var _width:Float;
|
||||
private var _link:String;
|
||||
private var _loading:Bool;
|
||||
|
||||
public function new(source:String, position:String, alpha:Float, width:Float=0.0)
|
||||
{
|
||||
super();
|
||||
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_loader = new Loader();
|
||||
_position = position;
|
||||
_alpha = alpha;
|
||||
_source = source;
|
||||
_width = width;
|
||||
_loading = true;
|
||||
|
||||
this.tabEnabled = false;
|
||||
|
||||
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
|
||||
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onNotLoaded);
|
||||
_loader.load(new URLRequest(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the logo image could not be loaded
|
||||
* @param event
|
||||
*/
|
||||
private function onNotLoaded(event:IOErrorEvent):Void
|
||||
{
|
||||
//Image not loaded
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the logo image finished loading.
|
||||
* @param event
|
||||
*/
|
||||
private function onLoaderComplete(event:Event):Void
|
||||
{
|
||||
addChild(_loader);
|
||||
|
||||
setWidth(_width);
|
||||
setPosition(_position);
|
||||
setAlpha(_alpha);
|
||||
_loading = false;
|
||||
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculate logo position on stage resize
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
setPosition(_position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the an url when the logo is clicked
|
||||
* @param event
|
||||
*/
|
||||
private function onLogoClick(event:MouseEvent):Void
|
||||
{
|
||||
Lib.getURL(new URLRequest(_link), "_blank");
|
||||
}
|
||||
|
||||
/**
|
||||
* Position where logo will be showing
|
||||
* @param position values could be top left, top right, bottom left, bottom right
|
||||
*/
|
||||
public function setPosition(position:String):Void
|
||||
{
|
||||
switch(position)
|
||||
{
|
||||
case "top left":
|
||||
this.x = 25;
|
||||
this.y = 25;
|
||||
|
||||
case "top right":
|
||||
this.x = _stage.stageWidth - this._width - 25;
|
||||
this.y = 25;
|
||||
|
||||
case "bottom left":
|
||||
this.x = 25;
|
||||
this.y = _stage.stageHeight - this.height - 25;
|
||||
|
||||
case "bottom right":
|
||||
this.x = _stage.stageWidth - this.width - 25;
|
||||
this.y = _stage.stageHeight - this.height - 25;
|
||||
|
||||
default:
|
||||
this.x = 25;
|
||||
this.y = 25;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To set logo transparency
|
||||
* @param alpha
|
||||
*/
|
||||
public function setAlpha(alpha:Float):Void
|
||||
{
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets logo width and recalculates height keeping aspect ratio
|
||||
* @param width
|
||||
*/
|
||||
public function setWidth(width:Float):Void
|
||||
{
|
||||
if (width > 0)
|
||||
{
|
||||
this.height = (this.height / this.width) * width;
|
||||
this.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Link that opens when clicked the logo image is clicked
|
||||
* @param link
|
||||
*/
|
||||
public function setLink(link:String):Void
|
||||
{
|
||||
_link = link;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.addEventListener(MouseEvent.CLICK, onLogoClick);
|
||||
}
|
||||
|
||||
/**
|
||||
* To check if the logo stills loading
|
||||
* @return true if loading false otherwise
|
||||
*/
|
||||
public function isLoading():Bool
|
||||
{
|
||||
return _loading;
|
||||
}
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.display;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.ContextMenuEvent;
|
||||
import flash.Lib;
|
||||
import flash.net.URLRequest;
|
||||
import flash.ui.ContextMenu;
|
||||
import flash.ui.ContextMenuItem;
|
||||
import jaris.player.Player;
|
||||
import jaris.player.AspectRatio;
|
||||
import jaris.Version;
|
||||
|
||||
/**
|
||||
* Modify original context menu
|
||||
*/
|
||||
class Menu
|
||||
{
|
||||
private var _movieClip:MovieClip;
|
||||
public static var _player:Player;
|
||||
|
||||
private var _contextMenu:ContextMenu;
|
||||
private var _jarisVersionMenuItem:ContextMenuItem;
|
||||
private var _playMenuItem:ContextMenuItem;
|
||||
private var _fullscreenMenuItem:ContextMenuItem;
|
||||
private var _aspectRatioMenuItem:ContextMenuItem;
|
||||
private var _muteMenuItem:ContextMenuItem;
|
||||
private var _volumeUpMenuItem:ContextMenuItem;
|
||||
private var _volumeDownMenuItem:ContextMenuItem;
|
||||
private var _qualityContextMenu:ContextMenuItem;
|
||||
|
||||
public function new(player:Player)
|
||||
{
|
||||
_movieClip = Lib.current;
|
||||
_player = player;
|
||||
|
||||
//Initialize context menu replacement
|
||||
_contextMenu = new ContextMenu();
|
||||
_contextMenu.hideBuiltInItems();
|
||||
|
||||
_contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, onMenuOpen);
|
||||
|
||||
//Initialize each menu item
|
||||
_jarisVersionMenuItem = new ContextMenuItem("Jaris Player v" + Version.NUMBER + " " + Version.STATUS, true, true, true);
|
||||
_jarisVersionMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onJarisVersion);
|
||||
|
||||
_playMenuItem = new ContextMenuItem("Play (SPACE)", true, true, true);
|
||||
_playMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onPlay);
|
||||
|
||||
_fullscreenMenuItem = new ContextMenuItem("Fullscreen View (F)");
|
||||
_fullscreenMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onFullscreen);
|
||||
|
||||
_aspectRatioMenuItem = new ContextMenuItem("Aspect Ratio (original) (TAB)");
|
||||
_aspectRatioMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onAspectRatio);
|
||||
|
||||
_muteMenuItem = new ContextMenuItem("Mute (M)");
|
||||
_muteMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onMute);
|
||||
|
||||
_volumeUpMenuItem = new ContextMenuItem("Volume + (arrow UP)");
|
||||
_volumeUpMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onVolumeUp);
|
||||
|
||||
_volumeDownMenuItem = new ContextMenuItem("Volume - (arrow DOWN)");
|
||||
_volumeDownMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onVolumeDown);
|
||||
|
||||
_qualityContextMenu = new ContextMenuItem("Lower Quality", true, true, true);
|
||||
_qualityContextMenu.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onQuality);
|
||||
|
||||
//add all context menu items to context menu object
|
||||
_contextMenu.customItems.push(_jarisVersionMenuItem);
|
||||
_contextMenu.customItems.push(_playMenuItem);
|
||||
_contextMenu.customItems.push(_fullscreenMenuItem);
|
||||
_contextMenu.customItems.push(_aspectRatioMenuItem);
|
||||
_contextMenu.customItems.push(_muteMenuItem);
|
||||
_contextMenu.customItems.push(_volumeUpMenuItem);
|
||||
_contextMenu.customItems.push(_volumeDownMenuItem);
|
||||
_contextMenu.customItems.push(_qualityContextMenu);
|
||||
|
||||
//override default context menu
|
||||
_movieClip.contextMenu = _contextMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update context menu item captions depending on player status before showing them
|
||||
* @param event
|
||||
*/
|
||||
private function onMenuOpen(event:ContextMenuEvent):Void
|
||||
{
|
||||
if (_player.isPlaying())
|
||||
{
|
||||
_playMenuItem.caption = "Pause (SPACE)";
|
||||
}
|
||||
else
|
||||
{
|
||||
_playMenuItem.caption = "Play (SPACE)";
|
||||
}
|
||||
|
||||
if (_player.isFullscreen())
|
||||
{
|
||||
_fullscreenMenuItem.caption = "Normal View";
|
||||
}
|
||||
else
|
||||
{
|
||||
_fullscreenMenuItem.caption = "Fullscreen View (F)";
|
||||
}
|
||||
|
||||
if (_player.getMute())
|
||||
{
|
||||
_muteMenuItem.caption = _player.isFullscreen()?"Unmute":"Unmute (M)";
|
||||
}
|
||||
else
|
||||
{
|
||||
_muteMenuItem.caption = _player.isFullscreen()?"Mute":"Mute (M)";
|
||||
}
|
||||
|
||||
switch(_player.getAspectRatioString())
|
||||
{
|
||||
case "original":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (1:1) (TAB)";
|
||||
|
||||
case "1:1":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (3:2) (TAB)";
|
||||
|
||||
case "3:2":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (4:3) (TAB)";
|
||||
|
||||
case "4:3":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (5:4) (TAB)";
|
||||
|
||||
case "5:4":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (14:9) (TAB)";
|
||||
|
||||
case "14:9":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (14:10) (TAB)";
|
||||
|
||||
case "14:10":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (16:9) (TAB)";
|
||||
|
||||
case "16:9":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (16:10) (TAB)";
|
||||
|
||||
case "16:10":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (original) (TAB)";
|
||||
}
|
||||
|
||||
if (_player.getQuality())
|
||||
{
|
||||
_qualityContextMenu.caption = "Lower Quality";
|
||||
}
|
||||
else
|
||||
{
|
||||
_qualityContextMenu.caption = "Higher Quality";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open jaris player website
|
||||
* @param event
|
||||
*/
|
||||
private function onJarisVersion(event:ContextMenuEvent)
|
||||
{
|
||||
Lib.getURL(new URLRequest("http://jaris.sourceforge.net"), "_blank");
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles playback
|
||||
* @param event
|
||||
*/
|
||||
private function onPlay(event:ContextMenuEvent)
|
||||
{
|
||||
_player.togglePlay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles fullscreen
|
||||
* @param event
|
||||
*/
|
||||
private function onFullscreen(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleFullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles aspect ratio
|
||||
* @param event
|
||||
*/
|
||||
private function onAspectRatio(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleAspectRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles mute
|
||||
* @param event
|
||||
*/
|
||||
private function onMute(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleMute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise volume
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeUp(event:ContextMenuEvent)
|
||||
{
|
||||
_player.volumeUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower volume
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeDown(event:ContextMenuEvent)
|
||||
{
|
||||
_player.volumeDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle video quality
|
||||
* @param event
|
||||
*/
|
||||
private function onQuality(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleQuality();
|
||||
}
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.display;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.Lib;
|
||||
import flash.net.URLRequest;
|
||||
import jaris.events.PlayerEvents;
|
||||
import jaris.player.InputType;
|
||||
import jaris.player.Player;
|
||||
|
||||
/**
|
||||
* To display an png, jpg or gif as preview of video content
|
||||
*/
|
||||
class Poster extends Sprite
|
||||
{
|
||||
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _loader:Loader;
|
||||
private var _source:String;
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _loading:Bool;
|
||||
private var _loaderStatus:jaris.display.Loader;
|
||||
private var _player:Player;
|
||||
|
||||
public function new(source:String)
|
||||
{
|
||||
super();
|
||||
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_loader = new Loader();
|
||||
_source = source;
|
||||
_loading = true;
|
||||
|
||||
//Reads flash vars
|
||||
var parameters:Dynamic<String> = flash.Lib.current.loaderInfo.parameters;
|
||||
|
||||
//Draw Loader status
|
||||
var loaderColors:Array <String> = ["", "", "", ""];
|
||||
loaderColors[0] = parameters.brightcolor != null ? parameters.brightcolor : "";
|
||||
loaderColors[1] = parameters.controlcolor != null ? parameters.controlcolor : "";
|
||||
|
||||
_loaderStatus = new jaris.display.Loader();
|
||||
_loaderStatus.show();
|
||||
_loaderStatus.setColors(loaderColors);
|
||||
addChild(_loaderStatus);
|
||||
|
||||
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
|
||||
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onNotLoaded);
|
||||
_loader.load(new URLRequest(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the poster image could not be loaded
|
||||
* @param event
|
||||
*/
|
||||
private function onNotLoaded(event:IOErrorEvent):Void
|
||||
{
|
||||
_loaderStatus.hide();
|
||||
removeChild(_loaderStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the poster image finalized loading
|
||||
* @param event
|
||||
*/
|
||||
private function onLoaderComplete(event:Event):Void
|
||||
{
|
||||
_loaderStatus.hide();
|
||||
removeChild(_loaderStatus);
|
||||
|
||||
addChild(_loader);
|
||||
|
||||
_width = this.width;
|
||||
_height = this.height;
|
||||
_loading = false;
|
||||
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
|
||||
resizeImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the stage is resized to resize the poster image
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
resizeImage();
|
||||
}
|
||||
|
||||
private function onPlayerMediaInitialized(event:PlayerEvents)
|
||||
{
|
||||
if (_player.getType() == InputType.VIDEO)
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlayerPlay(event:PlayerEvents)
|
||||
{
|
||||
if (_player.getType() == InputType.VIDEO)
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlayBackFinished(event:PlayerEvents)
|
||||
{
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the poster image to take all the stage
|
||||
*/
|
||||
private function resizeImage():Void
|
||||
{
|
||||
this.height = _stage.stageHeight;
|
||||
this.width = ((_width / _height) * this.height);
|
||||
|
||||
this.x = (_stage.stageWidth / 2) - (this.width / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* To check if the poster image stills loading
|
||||
* @return true if stills loading false if loaded
|
||||
*/
|
||||
public function isLoading():Bool
|
||||
{
|
||||
return _loading;
|
||||
}
|
||||
|
||||
public function setPlayer(player:Player):Void
|
||||
{
|
||||
_player = player;
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayBackFinished);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlay);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.events;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.media.ID3Info;
|
||||
import flash.media.Sound;
|
||||
import flash.net.NetStream;
|
||||
|
||||
/**
|
||||
* Implements the player events
|
||||
*/
|
||||
class PlayerEvents extends Event
|
||||
{
|
||||
public static var ASPECT_RATIO = "onAspectRatio";
|
||||
public static var MOUSE_SHOW = "onMouseShow";
|
||||
public static var MOUSE_HIDE = "onMouseHide";
|
||||
public static var FULLSCREEN = "onFullscreen";
|
||||
public static var VOLUME_UP = "onVolumeUp";
|
||||
public static var VOLUME_DOWN = "onVolumeDown";
|
||||
public static var VOLUME_CHANGE= "onVolumeChange"; //Nuevo
|
||||
public static var MUTE = "onMute";
|
||||
public static var FORWARD = "onForward";
|
||||
public static var REWIND = "onRewind";
|
||||
public static var PLAY_PAUSE = "onPlayPause";
|
||||
public static var SEEK = "onSeek";
|
||||
public static var TIME = "onTimeUpdate";
|
||||
public static var PROGRESS = "onProgress";
|
||||
public static var BUFFERING = "onBuffering";
|
||||
public static var NOT_BUFFERING = "onNotBuffering";
|
||||
public static var CONNECTION_FAILED = "onConnectionFailed";
|
||||
public static var CONNECTION_SUCCESS = "onConnectionSuccess";
|
||||
public static var MEDIA_INITIALIZED = "onDataInitialized";
|
||||
public static var PLAYBACK_FINISHED = "onPlaybackFinished";
|
||||
public static var STOP_CLOSE = "onStopAndClose";
|
||||
public static var RESIZE = "onResize";
|
||||
|
||||
public var name:String;
|
||||
public var aspectRatio:Float;
|
||||
public var duration:Float;
|
||||
public var fullscreen:Bool;
|
||||
public var mute:Bool;
|
||||
public var volume:Float;
|
||||
public var width:Float;
|
||||
public var height:Float;
|
||||
public var stream:NetStream;
|
||||
public var sound:Sound;
|
||||
public var time:Float;
|
||||
public var id3Info:ID3Info;
|
||||
|
||||
public function new(type:String, bubbles:Bool=false, cancelable:Bool=false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
|
||||
fullscreen = false;
|
||||
mute = false;
|
||||
volume = 1.0;
|
||||
duration = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
time = 0;
|
||||
name = type;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
/**
|
||||
* Stores the player used aspect ratio constants
|
||||
*/
|
||||
class AspectRatio
|
||||
{
|
||||
public static var _1_1:Float = 1 / 1;
|
||||
public static var _3_2:Float = 3 / 2;
|
||||
public static var _4_3:Float = 4 / 3;
|
||||
public static var _5_4:Float = 5 / 4;
|
||||
public static var _14_9:Float = 14 / 9;
|
||||
public static var _14_10:Float = 14 / 10;
|
||||
public static var _16_9:Float = 16 / 9;
|
||||
public static var _16_10:Float = 16 / 10;
|
||||
|
||||
/**
|
||||
* Calculates the ratio for a given width and height
|
||||
* @param width
|
||||
* @param height
|
||||
* @return aspect ratio
|
||||
*/
|
||||
public static function getAspectRatio(width:Float, height:Float):Float
|
||||
{
|
||||
return width / height;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
/**
|
||||
* Stores the identifiers for loaded media type
|
||||
*/
|
||||
class InputType
|
||||
{
|
||||
public static var AUDIO = "audio";
|
||||
public static var VIDEO = "video";
|
||||
}
|
|
@ -1,232 +0,0 @@
|
|||
/**
|
||||
* @author Sascha Kluger
|
||||
* @copyright 2010 Jefferson González, Sascha Kluger
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
//{Libraries
|
||||
import flash.system.Capabilities;
|
||||
import flash.system.Security;
|
||||
import flash.external.ExternalInterface;
|
||||
import flash.display.GradientType;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.display.MovieClip;
|
||||
import flash.net.NetStream;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.net.ObjectEncoding;
|
||||
import flash.text.AntiAliasType;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import jaris.animation.Animation;
|
||||
import jaris.display.Loader;
|
||||
import jaris.events.PlayerEvents;
|
||||
import jaris.player.controls.AspectRatioIcon;
|
||||
import jaris.player.controls.FullscreenIcon;
|
||||
import jaris.player.controls.PauseIcon;
|
||||
import jaris.player.controls.PlayIcon;
|
||||
import jaris.player.controls.VolumeIcon;
|
||||
import jaris.player.Player;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import jaris.utils.Utils;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Default controls for jaris player
|
||||
*/
|
||||
class JsApi extends MovieClip {
|
||||
|
||||
//{Member Variables
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _player:Player;
|
||||
private var _isBuffering:Bool;
|
||||
private var _percentLoaded:Float;
|
||||
private var _externalListeners:Hash<String>;
|
||||
|
||||
//}
|
||||
|
||||
|
||||
//{Constructor
|
||||
public function new(player:Player)
|
||||
{
|
||||
super();
|
||||
_externalListeners = new Hash<String>();
|
||||
|
||||
Security.allowDomain("*");
|
||||
|
||||
//{Main variables
|
||||
// _stage = Lib.current.stage;
|
||||
// _movieClip = Lib.current;
|
||||
_player = player;
|
||||
|
||||
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.BUFFERING, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.NOT_BUFFERING, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.RESIZE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.VOLUME_UP, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.VOLUME_DOWN, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.VOLUME_CHANGE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.MUTE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.TIME, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.PROGRESS, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.SEEK, onPlayerEvent);
|
||||
|
||||
ExternalInterface.addCallback("api_get", getAttribute);
|
||||
ExternalInterface.addCallback("api_addlistener", addJsListener);
|
||||
ExternalInterface.addCallback("api_removelistener", removeJsListener);
|
||||
ExternalInterface.addCallback("api_play", setPlay);
|
||||
ExternalInterface.addCallback("api_pause", setPause);
|
||||
ExternalInterface.addCallback("api_seek", setSeek);
|
||||
ExternalInterface.addCallback("api_volume", setVolume);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getAttribute(attribute:String):Float {
|
||||
|
||||
switch (attribute) {
|
||||
case 'isBuffering':
|
||||
return (_isBuffering) ? 1 : 0;
|
||||
|
||||
case 'isPlaying':
|
||||
return (_player.isPlaying()) ? 1 : 0;
|
||||
|
||||
case 'time':
|
||||
return Math.round(_player.getCurrentTime() * 10) / 10;
|
||||
|
||||
case 'loaded':
|
||||
return _player.getBytesLoaded();
|
||||
|
||||
case 'volume':
|
||||
return (_player.getMute()==true) ? 0 : _player.getVolume();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function addJsListener(attribute:String, parameter:String):Void {
|
||||
_externalListeners.set(attribute.toLowerCase(), parameter);
|
||||
}
|
||||
|
||||
public function removeJsListener(attribute:String):Void {
|
||||
if (attribute == '*')
|
||||
{
|
||||
_externalListeners = new Hash<String>();
|
||||
return;
|
||||
}
|
||||
_externalListeners.remove(attribute.toLowerCase());
|
||||
}
|
||||
|
||||
public function onPlayerEvent(event:PlayerEvents):Void
|
||||
{
|
||||
var jsFunction = '';
|
||||
var data = {
|
||||
duration: event.duration,
|
||||
fullscreen: event.fullscreen,
|
||||
mute: event.mute,
|
||||
volume: event.volume,
|
||||
position: event.time,
|
||||
type: event.name,
|
||||
loaded: _player.getBytesLoaded(),
|
||||
total: _player.getBytesTotal()
|
||||
};
|
||||
|
||||
if (_externalListeners.exists(event.name.toLowerCase()))
|
||||
{
|
||||
ExternalInterface.call(_externalListeners.get(event.name.toLowerCase()), data);
|
||||
}
|
||||
|
||||
if (_externalListeners.exists('on*'))
|
||||
{
|
||||
ExternalInterface.call(_externalListeners.get('on*'), data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
*/
|
||||
private function setPlay():Void
|
||||
{
|
||||
if (_player.isPlaying()!=true) {
|
||||
_player.togglePlay();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles play or pause
|
||||
*/
|
||||
private function setPause():Void
|
||||
{
|
||||
if (_player.isPlaying()==true) {
|
||||
_player.togglePlay();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Seek
|
||||
*/
|
||||
private function setSeek(pos:Float):Void
|
||||
{
|
||||
_player.seek(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Volume
|
||||
*/
|
||||
private function setVolume(vol:Float):Void
|
||||
{
|
||||
if (vol <= 0 && _player.getMute()!=true) {
|
||||
_player.toggleMute();
|
||||
_player.setVolume(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player.getMute() == true) {
|
||||
_player.toggleMute();
|
||||
}
|
||||
|
||||
if (vol >= 1) {
|
||||
_player.setVolume(1);
|
||||
return;
|
||||
}
|
||||
|
||||
_player.setVolume(vol);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
//{Libraries
|
||||
import jaris.events.PlayerEvents;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Implements a loop mechanism on the player
|
||||
*/
|
||||
class Loop
|
||||
{
|
||||
private var _player:Player;
|
||||
|
||||
public function new(player:Player)
|
||||
{
|
||||
_player = player;
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerStop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Everytime the player stops, the playback is restarted
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerStop(event:PlayerEvents):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
/**
|
||||
* Some constants for the stream types
|
||||
*/
|
||||
class StreamType
|
||||
{
|
||||
public static var FILE:String = "file";
|
||||
public static var PSEUDOSTREAM:String = "http";
|
||||
public static var RTMP:String = "rtmp";
|
||||
public static var YOUTUBE = "youtube";
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
import flash.net.SharedObject;
|
||||
|
||||
|
||||
/**
|
||||
* To store and retrieve user settings so the player can load them next time it loads.
|
||||
* In this way player can remember user selected aspect ratio and volume.
|
||||
*/
|
||||
class UserSettings
|
||||
{
|
||||
private var _settings:SharedObject;
|
||||
|
||||
public function new()
|
||||
{
|
||||
_settings = SharedObject.getLocal("JarisPlayerUserSettings");
|
||||
}
|
||||
|
||||
//{Methods
|
||||
/**
|
||||
* Deletes all user settings
|
||||
*/
|
||||
public function deleteSettings():Void
|
||||
{
|
||||
_settings.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a user setting is available
|
||||
* @param field The name of the setting
|
||||
* @return true if is set false otherwise
|
||||
*/
|
||||
public function isSet(field:String):Bool
|
||||
{
|
||||
return Reflect.hasField(_settings.data, field);
|
||||
}
|
||||
//}
|
||||
|
||||
//{Properties Setters
|
||||
/**
|
||||
* Stores the volume value
|
||||
* @param level
|
||||
*/
|
||||
public function setVolume(level:Float):Void
|
||||
{
|
||||
_settings.data.volume = level;
|
||||
_settings.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the aspect ratio value
|
||||
* @param aspect
|
||||
*/
|
||||
public function setAspectRatio(aspectratio:Float):Void
|
||||
{
|
||||
_settings.data.aspectratio = aspectratio;
|
||||
_settings.flush();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Properties Getters
|
||||
/**
|
||||
* The last user selected volume value
|
||||
* @return Last user selected volume value or default if not set.
|
||||
*/
|
||||
public function getVolume():Float
|
||||
{
|
||||
if (!isSet("volume"))
|
||||
{
|
||||
return 1.0; //The maximum volume value
|
||||
}
|
||||
|
||||
return _settings.data.volume;
|
||||
}
|
||||
|
||||
/**
|
||||
* The last user selected aspect ratio value
|
||||
* @return Last user selected aspect ratio value or default if not set.
|
||||
*/
|
||||
public function getAspectRatio():Float
|
||||
{
|
||||
if (!isSet("aspectratio"))
|
||||
{
|
||||
return 0.0; //Equivalent to original
|
||||
}
|
||||
|
||||
return _settings.data.aspectratio;
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.controls;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
class AspectRatioIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle(2, color);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
|
||||
var innerWidth:Float = (60 / 100) * width;
|
||||
var innerHeight:Float = (60 / 100) * height;
|
||||
var innerX:Float = (width / 2) - (innerWidth / 2) - 1;
|
||||
var innerY:Float = (height / 2) - (innerHeight / 2) - 1;
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color, 1);
|
||||
graphics.drawRect(innerX, innerY, innerWidth, innerHeight);
|
||||
graphics.endFill();
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(0, 0);
|
||||
graphics.drawRect(0, 0, width, height);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,912 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.controls;
|
||||
|
||||
//{Libraries
|
||||
import flash.display.GradientType;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.display.MovieClip;
|
||||
import flash.net.NetStream;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.text.AntiAliasType;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import jaris.animation.Animation;
|
||||
import jaris.display.Loader;
|
||||
import jaris.events.PlayerEvents;
|
||||
import jaris.player.controls.AspectRatioIcon;
|
||||
import jaris.player.controls.FullscreenIcon;
|
||||
import jaris.player.controls.PauseIcon;
|
||||
import jaris.player.controls.PlayIcon;
|
||||
import jaris.player.controls.VolumeIcon;
|
||||
import jaris.player.Player;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import jaris.utils.Utils;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Default controls for jaris player
|
||||
*/
|
||||
class Controls extends MovieClip {
|
||||
|
||||
//{Member Variables
|
||||
private var _thumb:Sprite;
|
||||
private var _track:Sprite;
|
||||
private var _trackDownloaded:Sprite;
|
||||
private var _scrubbing:Bool;
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _player:Player;
|
||||
private var _darkColor:UInt;
|
||||
private var _brightColor:UInt;
|
||||
private var _controlColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
private var _hideControlsTimer:Timer;
|
||||
private var _hideAspectRatioLabelTimer:Timer;
|
||||
private var _currentPlayTimeLabel:TextField;
|
||||
private var _totalPlayTimeLabel:TextField;
|
||||
private var _seekPlayTimeLabel:TextField;
|
||||
private var _percentLoaded:Float;
|
||||
private var _controlsVisible:Bool;
|
||||
private var _seekBar:Sprite;
|
||||
private var _controlsBar:Sprite;
|
||||
private var _playControl:PlayIcon;
|
||||
private var _pauseControl:PauseIcon;
|
||||
private var _aspectRatioControl:AspectRatioIcon;
|
||||
private var _fullscreenControl:FullscreenIcon;
|
||||
private var _volumeIcon:VolumeIcon;
|
||||
private var _volumeTrack:Sprite;
|
||||
private var _volumeSlider:Sprite;
|
||||
private var _loader:Loader;
|
||||
private var _aspectRatioLabelContainer:Sprite;
|
||||
private var _aspectRatioLabel:TextField;
|
||||
private var _textFormat:TextFormat;
|
||||
//}
|
||||
|
||||
|
||||
//{Constructor
|
||||
public function new(player:Player)
|
||||
{
|
||||
super();
|
||||
|
||||
//{Main variables
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_player = player;
|
||||
_darkColor = 0x000000;
|
||||
_brightColor = 0x4c4c4c;
|
||||
_controlColor = 0xFFFFFF;
|
||||
_hoverColor = 0x67A8C1;
|
||||
_percentLoaded = 0.0;
|
||||
_hideControlsTimer = new Timer(500);
|
||||
_hideAspectRatioLabelTimer = new Timer(500);
|
||||
_controlsVisible = false;
|
||||
|
||||
_textFormat = new TextFormat();
|
||||
_textFormat.font = "arial";
|
||||
_textFormat.color = _controlColor;
|
||||
_textFormat.size = 14;
|
||||
//}
|
||||
|
||||
//{Seeking Controls initialization
|
||||
_seekBar = new Sprite();
|
||||
addChild(_seekBar);
|
||||
|
||||
_trackDownloaded = new Sprite( );
|
||||
_trackDownloaded.tabEnabled = false;
|
||||
_seekBar.addChild(_trackDownloaded);
|
||||
|
||||
_track = new Sprite( );
|
||||
_track.tabEnabled = false;
|
||||
_track.buttonMode = true;
|
||||
_track.useHandCursor = true;
|
||||
_seekBar.addChild(_track);
|
||||
|
||||
|
||||
_thumb = new Sprite( );
|
||||
_thumb.buttonMode = true;
|
||||
_thumb.useHandCursor = true;
|
||||
_thumb.tabEnabled = false;
|
||||
_seekBar.addChild(_thumb);
|
||||
|
||||
_currentPlayTimeLabel = new TextField();
|
||||
_currentPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_currentPlayTimeLabel.text = "00:00:00";
|
||||
_currentPlayTimeLabel.tabEnabled = false;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_currentPlayTimeLabel);
|
||||
|
||||
_totalPlayTimeLabel = new TextField();
|
||||
_totalPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_totalPlayTimeLabel.text = "00:00:00";
|
||||
_totalPlayTimeLabel.tabEnabled = false;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_totalPlayTimeLabel);
|
||||
|
||||
_seekPlayTimeLabel = new TextField();
|
||||
_seekPlayTimeLabel.visible = false;
|
||||
_seekPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_seekPlayTimeLabel.text = "00:00:00";
|
||||
_seekPlayTimeLabel.tabEnabled = false;
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
addChild(_seekPlayTimeLabel);
|
||||
//}
|
||||
|
||||
//{Playing controls initialization
|
||||
_controlsBar = new Sprite();
|
||||
_controlsBar.visible = true;
|
||||
addChild(_controlsBar);
|
||||
|
||||
_playControl = new PlayIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_playControl);
|
||||
|
||||
_pauseControl = new PauseIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_pauseControl.visible = false;
|
||||
_controlsBar.addChild(_pauseControl);
|
||||
|
||||
_aspectRatioControl = new AspectRatioIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_aspectRatioControl);
|
||||
|
||||
_fullscreenControl = new FullscreenIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_fullscreenControl);
|
||||
|
||||
_volumeIcon = new VolumeIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_volumeIcon);
|
||||
|
||||
_volumeSlider = new Sprite();
|
||||
_controlsBar.addChild(_volumeSlider);
|
||||
|
||||
_volumeTrack = new Sprite();
|
||||
_volumeTrack.buttonMode = true;
|
||||
_volumeTrack.useHandCursor = true;
|
||||
_volumeTrack.tabEnabled = false;
|
||||
_controlsBar.addChild(_volumeTrack);
|
||||
//}
|
||||
|
||||
//{Aspect ratio label
|
||||
_aspectRatioLabelContainer = new Sprite();
|
||||
addChild(_aspectRatioLabelContainer);
|
||||
|
||||
_aspectRatioLabel = new TextField();
|
||||
_aspectRatioLabel.autoSize = TextFieldAutoSize.CENTER;
|
||||
_aspectRatioLabel.text = "original";
|
||||
_aspectRatioLabel.tabEnabled = false;
|
||||
_aspectRatioLabelContainer.addChild(_aspectRatioLabel);
|
||||
//}
|
||||
|
||||
redrawControls();
|
||||
|
||||
//{Loader bar
|
||||
_loader = new Loader();
|
||||
_loader.hide();
|
||||
|
||||
var loaderColors:Array <String> = ["", "", "", ""];
|
||||
loaderColors[0] = Std.string(_brightColor);
|
||||
loaderColors[1] = Std.string(_controlColor);
|
||||
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
addChild(_loader);
|
||||
//}
|
||||
|
||||
//{event Listeners
|
||||
_movieClip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_DOWN, onThumbMouseDown);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OVER, onThumbHover);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseOut);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_track.addEventListener(MouseEvent.CLICK, onTrackClick);
|
||||
_track.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_track.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_playControl.addEventListener(MouseEvent.CLICK, onPlayClick);
|
||||
_pauseControl.addEventListener(MouseEvent.CLICK, onPauseClick);
|
||||
_aspectRatioControl.addEventListener(MouseEvent.CLICK, onAspectRatioClick);
|
||||
_fullscreenControl.addEventListener(MouseEvent.CLICK, onFullscreenClick);
|
||||
_volumeIcon.addEventListener(MouseEvent.CLICK, onVolumeIconClick);
|
||||
_volumeTrack.addEventListener(MouseEvent.CLICK, onVolumeTrackClick);
|
||||
|
||||
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerMouseHide);
|
||||
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerMouseShow);
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
|
||||
_player.addEventListener(PlayerEvents.BUFFERING, onPlayerBuffering);
|
||||
_player.addEventListener(PlayerEvents.NOT_BUFFERING, onPlayerNotBuffering);
|
||||
_player.addEventListener(PlayerEvents.RESIZE, onPlayerResize);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlayPause);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerPlaybackFinished);
|
||||
_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerStreamNotFound);
|
||||
_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerAspectRatio);
|
||||
|
||||
_stage.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
|
||||
_hideControlsTimer.addEventListener(TimerEvent.TIMER, hideControlsTimer);
|
||||
_hideAspectRatioLabelTimer.addEventListener(TimerEvent.TIMER, hideAspectRatioLabelTimer);
|
||||
|
||||
_hideControlsTimer.start();
|
||||
//}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Timers
|
||||
/**
|
||||
* Hides the playing controls when not moving mouse.
|
||||
* @param event The timer event associated
|
||||
*/
|
||||
private function hideControlsTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_player.isPlaying())
|
||||
{
|
||||
if (_controlsVisible)
|
||||
{
|
||||
if (_stage.mouseX < _controlsBar.x ||
|
||||
_stage.mouseX >= _stage.stageWidth - 1 ||
|
||||
_stage.mouseY >= _stage.stageHeight - 1 ||
|
||||
_stage.mouseY <= 1
|
||||
)
|
||||
{
|
||||
_controlsVisible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hideControls();
|
||||
_hideControlsTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides aspect ratio label
|
||||
* @param event
|
||||
*/
|
||||
private function hideAspectRatioLabelTimer(event:TimerEvent):Void
|
||||
{
|
||||
//wait till fade in effect finish
|
||||
if (_aspectRatioLabelContainer.alpha >= 1)
|
||||
{
|
||||
Animation.fadeOut(_aspectRatioLabelContainer, 300);
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Events
|
||||
/**
|
||||
* Keeps syncronized various elements of the controls like the thumb and download track bar
|
||||
* @param event
|
||||
*/
|
||||
private function onEnterFrame(event:Event):Void
|
||||
{
|
||||
if(_player.getDuration() > 0) {
|
||||
if (_scrubbing)
|
||||
{
|
||||
_player.seek(((_thumb.x - _track.x) / _track.width) * _player.getDuration());
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPlayTimeLabel.text = Utils.formatTime(_player.getCurrentTime());
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_thumb.x = _player.getCurrentTime() / _player.getDuration() * (_track.width-_thumb.width) + _track.x;
|
||||
}
|
||||
}
|
||||
|
||||
_volumeSlider.height = _volumeTrack.height * (_player.getVolume() / 1.0);
|
||||
_volumeSlider.y = (_volumeTrack.y + _volumeTrack.height) - _volumeSlider.height;
|
||||
|
||||
drawDownloadProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show playing controls on mouse movement.
|
||||
* @param event
|
||||
*/
|
||||
private function onMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
if (_stage.mouseX >= _controlsBar.x)
|
||||
{
|
||||
if (!_hideControlsTimer.running)
|
||||
{
|
||||
_hideControlsTimer.start();
|
||||
}
|
||||
|
||||
_controlsVisible = true;
|
||||
showControls();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function fired by a stage resize eventthat redraws the player controls
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPauseClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles betewen aspect ratios
|
||||
* @param event
|
||||
*/
|
||||
private function onAspectRatioClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleAspectRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between window and fullscreen mode
|
||||
* @param event
|
||||
*/
|
||||
private function onFullscreenClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleFullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between mute and unmute
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeIconClick(event: MouseEvent):Void
|
||||
{
|
||||
_player.toggleMute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect user click on volume track control and change volume according
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var percent:Float = _volumeTrack.height - _volumeTrack.mouseY;
|
||||
var volume:Float = 1.0 * (percent / _volumeTrack.height);
|
||||
|
||||
_player.setVolume(volume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display not found message
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerStreamNotFound(event:PlayerEvents):Void
|
||||
{
|
||||
//todo: to work on this
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the loader bar when buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides loader bar when not buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerNotBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the selected aspect ratio
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerAspectRatio(event:PlayerEvents):Void
|
||||
{
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
_aspectRatioLabel.text = _player.getAspectRatioString();
|
||||
drawAspectRatioLabel();
|
||||
|
||||
while (_aspectRatioLabelContainer.visible)
|
||||
{
|
||||
//wait till fade out finishes
|
||||
}
|
||||
|
||||
Animation.fadeIn(_aspectRatioLabelContainer, 300);
|
||||
|
||||
_hideAspectRatioLabelTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors playbeack when finishes tu update controls
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlaybackFinished(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
showControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors keyboard play pause actions to update icons
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlayPause(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the video player on windowed mode substracting the seekbar height
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerResize(event:PlayerEvents):Void
|
||||
{
|
||||
if (!_player.isFullscreen())
|
||||
{
|
||||
if (_player.getVideo().y + _player.getVideo().height >= _stage.stageHeight)
|
||||
{
|
||||
_player.getVideo().height = _stage.stageHeight - _seekBar.height;
|
||||
_player.getVideo().width = _player.getVideo().height * _player.getAspectRatio();
|
||||
|
||||
_player.getVideo().x = (_stage.stageWidth / 2) - (_player.getVideo().width / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates media total time duration.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMediaInitialized(event:PlayerEvents):Void
|
||||
{
|
||||
_totalPlayTimeLabel.text = Utils.formatTime(event.duration);
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides seekbar if on fullscreen.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseHide(event:PlayerEvents):Void
|
||||
{
|
||||
if (_seekBar.visible && _player.isFullscreen())
|
||||
{
|
||||
Animation.slideOut(_seekBar, "bottom", 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows seekbar
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseShow(event:PlayerEvents):Void
|
||||
{
|
||||
//Only use slidein effect on fullscreen since switching to windowed mode on
|
||||
//hardware scaling causes a bug by a slow response on stage height changes
|
||||
if (_player.isFullscreen() && !_seekBar.visible)
|
||||
{
|
||||
Animation.slideIn(_seekBar, "bottom",1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
_seekBar.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a user click in to time and seeks to it
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_player.seek(_player.getDuration() * (clickPosition / _track.width));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a small tooltip showing the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_seekPlayTimeLabel.text = Utils.formatTime(_player.getDuration() * (clickPosition / _track.width));
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_seekPlayTimeLabel.y = _stage.stageHeight - _seekBar.height - _seekPlayTimeLabel.height - 1;
|
||||
_seekPlayTimeLabel.x = clickPosition + (_seekPlayTimeLabel.width / 2);
|
||||
|
||||
_seekPlayTimeLabel.backgroundColor = _brightColor;
|
||||
_seekPlayTimeLabel.background = true;
|
||||
_seekPlayTimeLabel.textColor = _controlColor;
|
||||
_seekPlayTimeLabel.borderColor = _darkColor;
|
||||
_seekPlayTimeLabel.border = true;
|
||||
|
||||
if (!_seekPlayTimeLabel.visible)
|
||||
{
|
||||
Animation.fadeIn(_seekPlayTimeLabel, 300);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the tooltip that shows the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
Animation.fadeOut(_seekPlayTimeLabel, 300);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables dragging of thumb for seeking media
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseDown(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = true;
|
||||
var rectangle:Rectangle = new Rectangle(_track.x, _track.y, _track.width-_thumb.width, 0);
|
||||
_thumb.startDrag(false, rectangle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to hover color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbHover(event:MouseEvent):Void
|
||||
{
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_hoverColor);
|
||||
_thumb.graphics.drawRect(0, (_seekBar.height/2)-(10/2), 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to control color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_controlColor);
|
||||
_thumb.graphics.drawRect(0, (_seekBar.height/2)-(10/2), 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables dragging of thumb
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseUp(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = false;
|
||||
_thumb.stopDrag( );
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Drawing functions
|
||||
/**
|
||||
* Clears all current graphics a draw new ones
|
||||
*/
|
||||
private function redrawControls():Void
|
||||
{
|
||||
drawSeekControls();
|
||||
drawPlayingControls();
|
||||
drawAspectRatioLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the download progress track bar
|
||||
*/
|
||||
private function drawDownloadProgress():Void
|
||||
{
|
||||
if (_player.getBytesTotal() > 0)
|
||||
{
|
||||
var bytesLoaded:Float = _player.getBytesLoaded();
|
||||
var bytesTotal:Float = _player.getBytesTotal();
|
||||
|
||||
_percentLoaded = bytesLoaded / bytesTotal;
|
||||
}
|
||||
|
||||
var position:Float = _player.getStartTime() / _player.getDuration();
|
||||
//var startPosition:Float = (position * _track.width) + _track.x; //Old way
|
||||
var startPosition:Float = (position > 0?(position * _track.width):0) + _track.x;
|
||||
|
||||
_trackDownloaded.graphics.clear();
|
||||
_trackDownloaded.graphics.lineStyle();
|
||||
_trackDownloaded.x = startPosition;
|
||||
_trackDownloaded.graphics.beginFill(_brightColor, 0xFFFFFF);
|
||||
_trackDownloaded.graphics.drawRect(0, (_seekBar.height / 2) - (10 / 2), ((_track.width + _track.x) - _trackDownloaded.x) * _percentLoaded, 10);
|
||||
_trackDownloaded.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws all seekbar controls
|
||||
*/
|
||||
private function drawSeekControls()
|
||||
{
|
||||
//Reset sprites for redraw
|
||||
_seekBar.graphics.clear();
|
||||
_track.graphics.clear();
|
||||
_thumb.graphics.clear();
|
||||
|
||||
//Draw seek bar
|
||||
var _seekBarWidth:UInt = _stage.stageWidth;
|
||||
var _seekBarHeight:UInt = 25;
|
||||
_seekBar.x = 0;
|
||||
_seekBar.y = _stage.stageHeight - _seekBarHeight;
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_seekBarWidth, _seekBarHeight, Utils.degreesToRadians(90), 0, 0);
|
||||
var colors:Array<UInt> = [_brightColor, _darkColor];
|
||||
var alphas:Array<UInt> = [1, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
_seekBar.graphics.lineStyle();
|
||||
_seekBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
_seekBar.graphics.drawRect(0, 0, _seekBarWidth, _seekBarHeight);
|
||||
_seekBar.graphics.endFill();
|
||||
|
||||
_textFormat.color = _controlColor;
|
||||
|
||||
//Draw current play time label
|
||||
_currentPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_currentPlayTimeLabel.height / 2);
|
||||
_currentPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw total play time label
|
||||
_totalPlayTimeLabel.x = _seekBarWidth - _totalPlayTimeLabel.width;
|
||||
_totalPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_totalPlayTimeLabel.height / 2);
|
||||
_totalPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw download progress
|
||||
drawDownloadProgress();
|
||||
|
||||
//Draw track place holder for drag
|
||||
_track.x = _currentPlayTimeLabel.width;
|
||||
_track.graphics.lineStyle(1, _controlColor);
|
||||
_track.graphics.beginFill(_darkColor, 0);
|
||||
_track.graphics.drawRect(0, (_seekBarHeight / 2) - (10 / 2), _seekBarWidth - _currentPlayTimeLabel.width - _totalPlayTimeLabel.width, 10);
|
||||
_track.graphics.endFill();
|
||||
|
||||
//Draw thumb
|
||||
_thumb.x = _currentPlayTimeLabel.width;
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_controlColor);
|
||||
_thumb.graphics.drawRect(0, (_seekBarHeight/2)-(10/2), 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws control bar player controls
|
||||
*/
|
||||
private function drawPlayingControls():Void
|
||||
{
|
||||
//Reset sprites for redraw
|
||||
_controlsBar.graphics.clear();
|
||||
_volumeTrack.graphics.clear();
|
||||
_volumeSlider.graphics.clear();
|
||||
|
||||
//Draw controls bar
|
||||
var barMargin = _stage.stageHeight < 330 ? 5 : 25;
|
||||
var barHeight = _stage.stageHeight - _seekBar.height - (barMargin * 2);
|
||||
var barWidth = _stage.stageHeight < 330 ? 45 : 60;
|
||||
_controlsBar.x = (_stage.stageWidth - barWidth) + 20;
|
||||
_controlsBar.y = barMargin;
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(barWidth, barHeight, Utils.degreesToRadians(0), 0, barHeight);
|
||||
var colors:Array<UInt> = [_brightColor, _darkColor];
|
||||
var alphas:Array<Float> = [0.75, 0.75];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
_controlsBar.graphics.lineStyle();
|
||||
_controlsBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
_controlsBar.graphics.drawRoundRect(0, 0, barWidth, barHeight, 20, 20);
|
||||
_controlsBar.graphics.endFill();
|
||||
|
||||
var topMargin:Float = _stage.stageHeight < 330 ? 5 : 10;
|
||||
var barCenter:Float = (barWidth - 20) / 2;
|
||||
var buttonSize:Float = ((80 / 100) * (barWidth - 20));
|
||||
var buttonX:Float = buttonSize / 2;
|
||||
|
||||
//Draw playbutton
|
||||
_playControl.setNormalColor(_controlColor);
|
||||
_playControl.setHoverColor(_hoverColor);
|
||||
_playControl.setPosition(barCenter - buttonX, topMargin);
|
||||
_playControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw pausebutton
|
||||
_pauseControl.setNormalColor(_controlColor);
|
||||
_pauseControl.setHoverColor(_hoverColor);
|
||||
_pauseControl.setPosition(_playControl.x, topMargin);
|
||||
_pauseControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw aspec ratio button
|
||||
_aspectRatioControl.setNormalColor(_controlColor);
|
||||
_aspectRatioControl.setHoverColor(_hoverColor);
|
||||
_aspectRatioControl.setPosition(_playControl.x, (_playControl.y + buttonSize) + topMargin);
|
||||
_aspectRatioControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw fullscreen button
|
||||
_fullscreenControl.setNormalColor(_controlColor);
|
||||
_fullscreenControl.setHoverColor(_hoverColor);
|
||||
_fullscreenControl.setPosition(_playControl.x, (_aspectRatioControl.y + _aspectRatioControl.height) + topMargin);
|
||||
_fullscreenControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw volume icon
|
||||
_volumeIcon.setNormalColor(_controlColor);
|
||||
_volumeIcon.setHoverColor(_hoverColor);
|
||||
_volumeIcon.setPosition(_playControl.x, barHeight - _playControl.height - topMargin);
|
||||
_volumeIcon.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw volume track
|
||||
_volumeTrack.x = _playControl.x;
|
||||
_volumeTrack.y = (_fullscreenControl.y + _fullscreenControl.height) + topMargin;
|
||||
_volumeTrack.graphics.lineStyle(1, _controlColor);
|
||||
_volumeTrack.graphics.beginFill(0x000000, 0);
|
||||
_volumeTrack.graphics.drawRect(0, 0, _playControl.width / 2, _volumeIcon.y - (_fullscreenControl.y + _fullscreenControl.height) - (topMargin*2));
|
||||
_volumeTrack.graphics.endFill();
|
||||
_volumeTrack.x = barCenter - (_volumeTrack.width / 2);
|
||||
|
||||
//Draw volume slider
|
||||
_volumeSlider.x = _volumeTrack.x;
|
||||
_volumeSlider.y = _volumeTrack.y;
|
||||
_volumeSlider.graphics.lineStyle();
|
||||
_volumeSlider.graphics.beginFill(_controlColor, 1);
|
||||
_volumeSlider.graphics.drawRect(0, 0, _volumeTrack.width, _volumeTrack.height);
|
||||
_volumeSlider.graphics.endFill();
|
||||
|
||||
}
|
||||
|
||||
private function drawAspectRatioLabel():Void
|
||||
{
|
||||
_aspectRatioLabelContainer.graphics.clear();
|
||||
_aspectRatioLabelContainer.visible = false;
|
||||
|
||||
//Update aspect ratio label
|
||||
var textFormat:TextFormat = new TextFormat();
|
||||
textFormat.font = "arial";
|
||||
textFormat.bold = true;
|
||||
textFormat.size = 40;
|
||||
textFormat.color = _controlColor;
|
||||
|
||||
_aspectRatioLabel.setTextFormat(textFormat);
|
||||
_aspectRatioLabel.x = (_stage.stageWidth / 2) - (_aspectRatioLabel.width / 2);
|
||||
_aspectRatioLabel.y = (_stage.stageHeight / 2) - (_aspectRatioLabel.height / 2);
|
||||
|
||||
//Draw aspect ratio label container
|
||||
_aspectRatioLabelContainer.x = _aspectRatioLabel.x - 10;
|
||||
_aspectRatioLabelContainer.y = _aspectRatioLabel.y - 10;
|
||||
_aspectRatioLabelContainer.graphics.lineStyle(3, _controlColor);
|
||||
_aspectRatioLabelContainer.graphics.beginFill(_brightColor, 1);
|
||||
_aspectRatioLabelContainer.graphics.drawRoundRect(0, 0, _aspectRatioLabel.width + 20, _aspectRatioLabel.height + 20, 15, 15);
|
||||
_aspectRatioLabelContainer.graphics.endFill();
|
||||
|
||||
_aspectRatioLabel.x = 10;
|
||||
_aspectRatioLabel.y = 10;
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Private Methods
|
||||
/**
|
||||
* Hide the play controls bar
|
||||
*/
|
||||
private function hideControls():Void
|
||||
{
|
||||
if(_controlsBar.visible)
|
||||
{
|
||||
drawPlayingControls();
|
||||
Animation.slideOut(_controlsBar, "right", 800);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows play controls bar
|
||||
*/
|
||||
private function showControls():Void
|
||||
{
|
||||
if(!_controlsBar.visible)
|
||||
{
|
||||
drawPlayingControls();
|
||||
Animation.slideIn(_controlsBar, "right", 800);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Setters
|
||||
/**
|
||||
* Sets the player colors and redraw them
|
||||
* @param colors Array of colors in the following order: darkColor, brightColor, controlColor, hoverColor
|
||||
*/
|
||||
public function setControlColors(colors:Array<String>):Void
|
||||
{
|
||||
_darkColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x000000;
|
||||
_brightColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0x4c4c4c;
|
||||
_controlColor = colors[2].length > 0? Std.parseInt("0x" + colors[2]) : 0xFFFFFF;
|
||||
_hoverColor = colors[3].length > 0? Std.parseInt("0x" + colors[3]) : 0x67A8C1;
|
||||
|
||||
var loaderColors:Array <String> = ["", ""];
|
||||
loaderColors[0] = colors[1];
|
||||
loaderColors[1] = colors[2];
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* To set the duration label when autostart parameter is false
|
||||
* @param duration in seconds or formatted string in format hh:mm:ss
|
||||
*/
|
||||
public function setDurationLabel(duration:String):Void
|
||||
{
|
||||
//Person passed time already formatted
|
||||
if (duration.indexOf(":") != -1)
|
||||
{
|
||||
_totalPlayTimeLabel.text = duration;
|
||||
}
|
||||
|
||||
//Time passed in seconds
|
||||
else
|
||||
{
|
||||
_totalPlayTimeLabel.text = Std.string(Utils.formatTime(Std.parseFloat(duration)));
|
||||
}
|
||||
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.controls;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
class FullscreenIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle(2, color);
|
||||
graphics.beginFill(0x000000, 0);
|
||||
graphics.drawRoundRect(0, 0, _width, _height, 6, 6);
|
||||
graphics.endFill();
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color, 1);
|
||||
graphics.drawRoundRect(3, 3, 4, 4, 2, 2);
|
||||
graphics.drawRoundRect(width - 9, 3, 4, 4, 2, 2);
|
||||
graphics.drawRoundRect(3, height - 9, 4, 4, 2, 2);
|
||||
graphics.drawRoundRect(width - 9, height - 9, 4, 4, 2, 2);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.controls;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
class PauseIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color);
|
||||
graphics.drawRoundRect(0, 0, (33 / 100) * _width, _height, 6, 6);
|
||||
graphics.drawRoundRect(_width - ((33 / 100) * _width), 0, (33 / 100) * _width, _height, 6, 6);
|
||||
graphics.endFill();
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.controls;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
class PlayIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color);
|
||||
graphics.lineTo(0, _height);
|
||||
graphics.lineTo(_width, _height / 2);
|
||||
graphics.lineTo(0, 0);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.controls;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
class VolumeIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color, 1);
|
||||
graphics.drawRect(0, ((50 / 100) * _height) / 2, _width / 2, ((50 / 100) * _height));
|
||||
graphics.moveTo(_width / 2, ((50 / 100) * _height)/2);
|
||||
graphics.lineTo(_width, 0);
|
||||
graphics.lineTo(_width, _height);
|
||||
graphics.lineTo(_width / 2, ((50 / 100) * _height) + (((50 / 100) * _height) / 2));
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import jaris.utils.Utils;
|
||||
import flash.display.GradientType;
|
||||
|
||||
class AspectRatioIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle(0, color, 0.0);
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
|
||||
var colors:Array<UInt> = [color, color];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
var innerWidth:Float = (70 / 100) * width;
|
||||
var innerHeight:Float = (40 / 100) * height;
|
||||
var innerX:Float = (width / 2) - (innerWidth / 2) + 1 ;
|
||||
var innerY:Float = (height / 2) - (innerHeight / 2) + 1;
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//graphics.beginFill(color, 1);
|
||||
graphics.drawRect(0, 0, 1, _height+1);
|
||||
graphics.drawRect(0, 0, _width+1, 1);
|
||||
graphics.drawRect(_width+1, 0, 1, _height+1);
|
||||
graphics.drawRect(0, _height+1, _width+1, 1);
|
||||
graphics.drawRect(innerX, innerY, innerWidth, innerHeight);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import jaris.utils.Utils;
|
||||
import flash.display.GradientType;
|
||||
|
||||
class FullscreenIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle(0, color, 0.0);
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
|
||||
var arrowWidth = Std.int(_width / 2 * 0.8);
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
|
||||
var colors:Array<UInt> = [color, color];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
graphics.lineStyle(0, color, 0, true);
|
||||
graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, arrowWidth, 2);
|
||||
graphics.drawRect(0, 2, 2, arrowWidth-2);
|
||||
graphics.drawRect(_width-arrowWidth+1, 0, arrowWidth, 2);
|
||||
graphics.drawRect(_width-1, 2, 2, arrowWidth-2);
|
||||
graphics.drawRect(0, _height-arrowWidth+2, 2, arrowWidth);
|
||||
graphics.drawRect(2, _height, arrowWidth-2, 2);
|
||||
graphics.drawRect(_width-1, _height-arrowWidth+2, 2, arrowWidth-2);
|
||||
graphics.drawRect(_width-arrowWidth+1, _height, arrowWidth, 2);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.Lib;
|
||||
import flash.geom.Matrix;
|
||||
import jaris.utils.Utils;
|
||||
import flash.display.GradientType;
|
||||
|
||||
/**
|
||||
* Draws a loading bar
|
||||
*/
|
||||
class Loader extends Sprite
|
||||
{
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _background:Sprite;
|
||||
private var _loaderTrack:Sprite;
|
||||
private var _loaderThumb:Sprite;
|
||||
private var _visible:Bool;
|
||||
private var _darkColor:UInt;
|
||||
private var _controlColor:UInt;
|
||||
private var _seekColor:UInt;
|
||||
private var _forward:Bool;
|
||||
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
|
||||
_background = new Sprite();
|
||||
addChild(_background);
|
||||
|
||||
_loaderTrack = new Sprite();
|
||||
addChild(_loaderTrack);
|
||||
|
||||
_loaderThumb = new Sprite();
|
||||
addChild(_loaderThumb);
|
||||
|
||||
_darkColor = 0x000000;
|
||||
_controlColor = 0xFFFFFF;
|
||||
_seekColor = 0x747474;
|
||||
|
||||
_forward = true;
|
||||
_visible = true;
|
||||
|
||||
addEventListener(Event.ENTER_FRAME, onEnterFrame);
|
||||
_stage.addEventListener(Event.RESIZE, onResize);
|
||||
|
||||
drawLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Animation of a thumb moving on the track
|
||||
* @param event
|
||||
*/
|
||||
private function onEnterFrame(event:Event):Void
|
||||
{
|
||||
if (_visible)
|
||||
{
|
||||
if (_forward)
|
||||
{
|
||||
if ((_loaderThumb.x + _loaderThumb.width) >= (_loaderTrack.x + _loaderTrack.width))
|
||||
{
|
||||
_forward = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loaderThumb.x += 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_loaderThumb.x <= _loaderTrack.x)
|
||||
{
|
||||
_forward = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loaderThumb.x -= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraws the loader to match new stage size
|
||||
* @param event
|
||||
*/
|
||||
private function onResize(event:Event):Void
|
||||
{
|
||||
drawLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw loader graphics
|
||||
*/
|
||||
private function drawLoader():Void
|
||||
{
|
||||
//Clear graphics
|
||||
_background.graphics.clear();
|
||||
_loaderTrack.graphics.clear();
|
||||
_loaderThumb.graphics.clear();
|
||||
|
||||
//Draw background
|
||||
var backgroundWidth:Float = (65 / 100) * _stage.stageWidth;
|
||||
var backgroundHeight:Float = 30;
|
||||
_background.x = (_stage.stageWidth / 2) - (backgroundWidth / 2);
|
||||
_background.y = (_stage.stageHeight / 2) - (backgroundHeight / 2);
|
||||
_background.graphics.lineStyle();
|
||||
_background.graphics.beginFill(_darkColor, 0.75);
|
||||
_background.graphics.drawRoundRect(0, 0, backgroundWidth, backgroundHeight, 6, 6);
|
||||
_background.graphics.endFill();
|
||||
|
||||
//Draw track
|
||||
var trackWidth:Float = (50 / 100) * _stage.stageWidth;
|
||||
var trackHeight:Float = 11;
|
||||
_loaderTrack.x = (_stage.stageWidth / 2) - (trackWidth / 2);
|
||||
_loaderTrack.y = (_stage.stageHeight / 2) - (trackHeight / 2);
|
||||
_loaderTrack.graphics.lineStyle();
|
||||
_loaderTrack.graphics.beginFill(_seekColor, 0.3);
|
||||
_loaderTrack.graphics.drawRoundRect(0, trackHeight/2/2, trackWidth, trackHeight/2, 5, 5);
|
||||
|
||||
//Draw thumb
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(trackHeight*3, trackHeight, Utils.degreesToRadians(-90), trackHeight*3, 0);
|
||||
var colors:Array<UInt> = [_controlColor, _controlColor];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
_loaderThumb.x = _loaderTrack.x;
|
||||
_loaderThumb.y = _loaderTrack.y;
|
||||
_loaderThumb.graphics.lineStyle();
|
||||
_loaderThumb.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//_loaderThumb.graphics.beginFill(_controlColor, 1);
|
||||
_loaderThumb.graphics.drawRoundRect(0, 0, trackHeight*3, trackHeight, 10, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops drawing the loader
|
||||
*/
|
||||
public function hide():Void
|
||||
{
|
||||
this.visible = false;
|
||||
_visible = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts drawing the loader
|
||||
*/
|
||||
public function show():Void
|
||||
{
|
||||
this.visible = true;
|
||||
_visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set loader colors
|
||||
* @param colors
|
||||
*/
|
||||
public function setColors(colors:Array<String>):Void
|
||||
{
|
||||
_darkColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x000000;
|
||||
_controlColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0xFFFFFF;
|
||||
_seekColor = colors[2].length > 0? Std.parseInt("0x" + colors[2]) : 0x747474;
|
||||
|
||||
drawLoader();
|
||||
}
|
||||
}
|
|
@ -1,945 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
|
||||
//{Libraries
|
||||
import flash.display.GradientType;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.display.MovieClip;
|
||||
import flash.net.NetStream;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.text.AntiAliasType;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import jaris.animation.Animation;
|
||||
import jaris.events.PlayerEvents;
|
||||
import jaris.player.newcontrols.Loader;
|
||||
import jaris.player.newcontrols.AspectRatioIcon;
|
||||
import jaris.player.newcontrols.FullscreenIcon;
|
||||
import jaris.player.newcontrols.PauseIcon;
|
||||
import jaris.player.newcontrols.PlayIcon;
|
||||
import jaris.player.newcontrols.VolumeIcon;
|
||||
import jaris.player.Player;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import jaris.utils.Utils;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Default controls for jaris player
|
||||
*/
|
||||
class NewControls extends MovieClip {
|
||||
|
||||
//{Member Variables
|
||||
private var _thumb:Sprite;
|
||||
private var _track:Sprite;
|
||||
private var _trackDownloaded:Sprite;
|
||||
private var _scrubbing:Bool;
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _player:Player;
|
||||
private var _darkColor:UInt;
|
||||
private var _brightColor:UInt;
|
||||
private var _seekColor:UInt;
|
||||
private var _controlColor:UInt;
|
||||
private var _controlSize:Int;
|
||||
private var _hoverColor:UInt;
|
||||
private var _hideControlsTimer:Timer;
|
||||
private var _hideAspectRatioLabelTimer:Timer;
|
||||
private var _currentPlayTimeLabel:TextField;
|
||||
private var _totalPlayTimeLabel:TextField;
|
||||
private var _seekPlayTimeLabel:TextField;
|
||||
private var _percentLoaded:Float;
|
||||
private var _controlsVisible:Bool;
|
||||
private var _seekBar:Sprite;
|
||||
private var _controlsBar:Sprite;
|
||||
private var _playControl:PlayIcon;
|
||||
private var _pauseControl:PauseIcon;
|
||||
private var _aspectRatioControl:AspectRatioIcon;
|
||||
private var _fullscreenControl:FullscreenIcon;
|
||||
private var _volumeIcon:VolumeIcon;
|
||||
private var _volumeTrack:Sprite;
|
||||
private var _volumeSlider:Sprite;
|
||||
private var _loader:Loader;
|
||||
private var _aspectRatioLabelContainer:Sprite;
|
||||
private var _aspectRatioLabel:TextField;
|
||||
private var _textFormat:TextFormat;
|
||||
//}
|
||||
|
||||
|
||||
//{Constructor
|
||||
public function new(player:Player)
|
||||
{
|
||||
super();
|
||||
|
||||
//{Main variables
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_player = player;
|
||||
_darkColor = 0x000000;
|
||||
_brightColor = 0x4c4c4c;
|
||||
_controlColor = 0xFFFFFF;
|
||||
_hoverColor = 0x67A8C1;
|
||||
_seekColor = 0x7c7c7c;
|
||||
_controlSize = 40;
|
||||
_percentLoaded = 0.0;
|
||||
_hideControlsTimer = new Timer(500);
|
||||
_hideAspectRatioLabelTimer = new Timer(500);
|
||||
_controlsVisible = false;
|
||||
|
||||
_textFormat = new TextFormat();
|
||||
_textFormat.font = "arial";
|
||||
_textFormat.color = _controlColor;
|
||||
_textFormat.size = 14;
|
||||
//}
|
||||
|
||||
//{Playing controls initialization
|
||||
_controlsBar = new Sprite();
|
||||
_controlsBar.visible = true;
|
||||
addChild(_controlsBar);
|
||||
|
||||
_playControl = new PlayIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_playControl);
|
||||
|
||||
_pauseControl = new PauseIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_pauseControl.visible = false;
|
||||
_controlsBar.addChild(_pauseControl);
|
||||
|
||||
_aspectRatioControl = new AspectRatioIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_aspectRatioControl);
|
||||
|
||||
_fullscreenControl = new FullscreenIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_fullscreenControl);
|
||||
|
||||
_volumeIcon = new VolumeIcon(0, 0, 0, 0, _controlColor, _hoverColor);
|
||||
_controlsBar.addChild(_volumeIcon);
|
||||
|
||||
_volumeSlider = new Sprite();
|
||||
_volumeSlider.visible = false;
|
||||
_controlsBar.addChild(_volumeSlider);
|
||||
|
||||
_volumeTrack = new Sprite();
|
||||
_volumeTrack.visible = false;
|
||||
_volumeTrack.buttonMode = true;
|
||||
_volumeTrack.useHandCursor = true;
|
||||
_volumeTrack.tabEnabled = false;
|
||||
_controlsBar.addChild(_volumeTrack);
|
||||
//}
|
||||
|
||||
//{Seeking Controls initialization
|
||||
_seekBar = new Sprite();
|
||||
_controlsBar.addChild(_seekBar);
|
||||
|
||||
_trackDownloaded = new Sprite( );
|
||||
_trackDownloaded.tabEnabled = false;
|
||||
_seekBar.addChild(_trackDownloaded);
|
||||
|
||||
_track = new Sprite( );
|
||||
_track.tabEnabled = false;
|
||||
_track.buttonMode = true;
|
||||
_track.useHandCursor = true;
|
||||
_seekBar.addChild(_track);
|
||||
|
||||
_thumb = new Sprite( );
|
||||
_thumb.buttonMode = true;
|
||||
_thumb.useHandCursor = true;
|
||||
_thumb.tabEnabled = false;
|
||||
_seekBar.addChild(_thumb);
|
||||
|
||||
_currentPlayTimeLabel = new TextField();
|
||||
_currentPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_currentPlayTimeLabel.text = "00:00:00";
|
||||
_currentPlayTimeLabel.tabEnabled = false;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_currentPlayTimeLabel);
|
||||
|
||||
_totalPlayTimeLabel = new TextField();
|
||||
_totalPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_totalPlayTimeLabel.text = "00:00:00";
|
||||
_totalPlayTimeLabel.tabEnabled = false;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_totalPlayTimeLabel);
|
||||
|
||||
_seekPlayTimeLabel = new TextField();
|
||||
_seekPlayTimeLabel.visible = false;
|
||||
_seekPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_seekPlayTimeLabel.text = "00:00:00";
|
||||
_seekPlayTimeLabel.tabEnabled = false;
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
addChild(_seekPlayTimeLabel);
|
||||
//}
|
||||
|
||||
//{Aspect ratio label
|
||||
_aspectRatioLabelContainer = new Sprite();
|
||||
addChild(_aspectRatioLabelContainer);
|
||||
|
||||
_aspectRatioLabel = new TextField();
|
||||
_aspectRatioLabel.autoSize = TextFieldAutoSize.CENTER;
|
||||
_aspectRatioLabel.text = "original";
|
||||
_aspectRatioLabel.tabEnabled = false;
|
||||
_aspectRatioLabelContainer.addChild(_aspectRatioLabel);
|
||||
//}
|
||||
|
||||
redrawControls();
|
||||
|
||||
//{Loader bar
|
||||
_loader = new Loader();
|
||||
_loader.hide();
|
||||
|
||||
var loaderColors:Array <String> = ["", "", "", ""];
|
||||
loaderColors[0] = Std.string(_darkColor);
|
||||
loaderColors[1] = Std.string(_controlColor);
|
||||
loaderColors[2] = Std.string(_seekColor);
|
||||
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
addChild(_loader);
|
||||
//}
|
||||
|
||||
//{event Listeners
|
||||
_movieClip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_DOWN, onThumbMouseDown);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OVER, onThumbHover);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseOut);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_track.addEventListener(MouseEvent.CLICK, onTrackClick);
|
||||
_track.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_track.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_playControl.addEventListener(MouseEvent.CLICK, onPlayClick);
|
||||
_pauseControl.addEventListener(MouseEvent.CLICK, onPauseClick);
|
||||
_aspectRatioControl.addEventListener(MouseEvent.CLICK, onAspectRatioClick);
|
||||
_fullscreenControl.addEventListener(MouseEvent.CLICK, onFullscreenClick);
|
||||
_volumeIcon.addEventListener(MouseEvent.CLICK, onVolumeIconClick);
|
||||
_volumeTrack.addEventListener(MouseEvent.CLICK, onVolumeTrackClick);
|
||||
|
||||
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerMouseHide);
|
||||
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerMouseShow);
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
|
||||
_player.addEventListener(PlayerEvents.BUFFERING, onPlayerBuffering);
|
||||
_player.addEventListener(PlayerEvents.NOT_BUFFERING, onPlayerNotBuffering);
|
||||
_player.addEventListener(PlayerEvents.RESIZE, onPlayerResize);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlayPause);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerPlaybackFinished);
|
||||
_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerStreamNotFound);
|
||||
_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerAspectRatio);
|
||||
|
||||
_stage.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
|
||||
_hideControlsTimer.addEventListener(TimerEvent.TIMER, hideControlsTimer);
|
||||
_hideAspectRatioLabelTimer.addEventListener(TimerEvent.TIMER, hideAspectRatioLabelTimer);
|
||||
|
||||
_hideControlsTimer.start();
|
||||
//}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Timers
|
||||
/**
|
||||
* Hides the playing controls when not moving mouse.
|
||||
* @param event The timer event associated
|
||||
*/
|
||||
private function hideControlsTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_player.isPlaying())
|
||||
{
|
||||
if (_controlsVisible)
|
||||
{
|
||||
if (_stage.mouseX < _controlsBar.x ||
|
||||
_stage.mouseX >= _stage.stageWidth - 1 ||
|
||||
_stage.mouseY >= _stage.stageHeight - 1 ||
|
||||
_stage.mouseY <= 1
|
||||
)
|
||||
{
|
||||
_controlsVisible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hideControls();
|
||||
_hideControlsTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides aspect ratio label
|
||||
* @param event
|
||||
*/
|
||||
private function hideAspectRatioLabelTimer(event:TimerEvent):Void
|
||||
{
|
||||
//wait till fade in effect finish
|
||||
if (_aspectRatioLabelContainer.alpha >= 1)
|
||||
{
|
||||
Animation.fadeOut(_aspectRatioLabelContainer, 300);
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Events
|
||||
/**
|
||||
* Keeps syncronized various elements of the controls like the thumb and download track bar
|
||||
* @param event
|
||||
*/
|
||||
private function onEnterFrame(event:Event):Void
|
||||
{
|
||||
if(_player.getDuration() > 0) {
|
||||
if (_scrubbing)
|
||||
{
|
||||
_player.seek(((_thumb.x - _track.x) / _track.width) * _player.getDuration());
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPlayTimeLabel.text = Utils.formatTime(_player.getCurrentTime());
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_thumb.x = _player.getCurrentTime() / _player.getDuration() * (_track.width-_thumb.width) + _track.x;
|
||||
}
|
||||
}
|
||||
|
||||
_volumeSlider.height = _volumeTrack.height * (_player.getVolume() / 1.0);
|
||||
_volumeSlider.y = (_volumeTrack.y + _volumeTrack.height) - _volumeSlider.height;
|
||||
|
||||
drawDownloadProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show playing controls on mouse movement.
|
||||
* @param event
|
||||
*/
|
||||
private function onMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
if (_stage.mouseX >= _controlsBar.x)
|
||||
{
|
||||
if (!_hideControlsTimer.running)
|
||||
{
|
||||
_hideControlsTimer.start();
|
||||
}
|
||||
|
||||
_controlsVisible = true;
|
||||
showControls();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function fired by a stage resize eventthat redraws the player controls
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPauseClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles betewen aspect ratios
|
||||
* @param event
|
||||
*/
|
||||
private function onAspectRatioClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleAspectRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between window and fullscreen mode
|
||||
* @param event
|
||||
*/
|
||||
private function onFullscreenClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleFullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between mute and unmute
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeIconClick(event: MouseEvent):Void
|
||||
{
|
||||
if (_volumeSlider.visible) {
|
||||
_volumeSlider.visible = false;
|
||||
_volumeTrack.visible = false;
|
||||
} else {
|
||||
_volumeSlider.visible = true;
|
||||
_volumeTrack.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect user click on volume track control and change volume according
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var percent:Float = _volumeTrack.height - _volumeTrack.mouseY;
|
||||
var volume:Float = 1.0 * (percent / _volumeTrack.height);
|
||||
|
||||
_player.setVolume(volume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display not found message
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerStreamNotFound(event:PlayerEvents):Void
|
||||
{
|
||||
//todo: to work on this
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the loader bar when buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides loader bar when not buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerNotBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the selected aspect ratio
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerAspectRatio(event:PlayerEvents):Void
|
||||
{
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
_aspectRatioLabel.text = _player.getAspectRatioString();
|
||||
drawAspectRatioLabel();
|
||||
|
||||
while (_aspectRatioLabelContainer.visible)
|
||||
{
|
||||
//wait till fade out finishes
|
||||
}
|
||||
|
||||
Animation.fadeIn(_aspectRatioLabelContainer, 1);
|
||||
|
||||
_hideAspectRatioLabelTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors playbeack when finishes tu update controls
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlaybackFinished(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
showControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors keyboard play pause actions to update icons
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlayPause(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the video player on windowed mode substracting the seekbar height
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerResize(event:PlayerEvents):Void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates media total time duration.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMediaInitialized(event:PlayerEvents):Void
|
||||
{
|
||||
_totalPlayTimeLabel.text = Utils.formatTime(event.duration);
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides seekbar if on fullscreen.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseHide(event:PlayerEvents):Void
|
||||
{
|
||||
if (_controlsBar.visible && _player.isFullscreen())
|
||||
{
|
||||
hideControls();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows seekbar
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseShow(event:PlayerEvents):Void
|
||||
{
|
||||
//Only use slidein effect on fullscreen since switching to windowed mode on
|
||||
//hardware scaling causes a bug by a slow response on stage height changes
|
||||
if (_player.isFullscreen() && !_controlsBar.visible)
|
||||
{
|
||||
_controlsBar.visible = true;
|
||||
}
|
||||
else if (!_controlsBar.visible)
|
||||
{
|
||||
_controlsBar.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a user click in to time and seeks to it
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_player.seek(_player.getDuration() * (clickPosition / _track.width));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a small tooltip showing the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_seekPlayTimeLabel.text = Utils.formatTime(_player.getDuration() * (clickPosition / _track.width));
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_seekPlayTimeLabel.y = _stage.stageHeight - _seekBar.height - _seekPlayTimeLabel.height - 1;
|
||||
_seekPlayTimeLabel.x = clickPosition + (_seekPlayTimeLabel.width / 2) + (_playControl.width + 10) * 2;
|
||||
_seekPlayTimeLabel.backgroundColor = _darkColor;
|
||||
_seekPlayTimeLabel.background = true;
|
||||
_seekPlayTimeLabel.textColor = _controlColor;
|
||||
_seekPlayTimeLabel.borderColor = _darkColor;
|
||||
_seekPlayTimeLabel.border = true;
|
||||
|
||||
if (!_seekPlayTimeLabel.visible)
|
||||
{
|
||||
_seekPlayTimeLabel.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the tooltip that shows the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
_seekPlayTimeLabel.visible = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables dragging of thumb for seeking media
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseDown(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = true;
|
||||
var rectangle:Rectangle = new Rectangle(_track.x, _track.y, _track.width-_thumb.width, 0);
|
||||
_thumb.startDrag(false, rectangle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to hover color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbHover(event:MouseEvent):Void
|
||||
{
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_hoverColor);
|
||||
_thumb.graphics.drawRoundRect(0, (_seekBar.height/2)-(11/2), 11, 11, 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to control color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(11, 11, Utils.degreesToRadians(-90), 11, 0);
|
||||
var colors:Array<UInt> = [_controlColor, _controlColor];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
_thumb.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
_thumb.graphics.drawRoundRect(0, (_seekBar.height / 2) - (11 / 2), 11, 11, 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables dragging of thumb
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseUp(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = false;
|
||||
_thumb.stopDrag( );
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Drawing functions
|
||||
/**
|
||||
* Clears all current graphics a draw new ones
|
||||
*/
|
||||
private function redrawControls():Void
|
||||
{
|
||||
drawControls();
|
||||
drawAspectRatioLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the download progress track bar
|
||||
*/
|
||||
private function drawDownloadProgress():Void
|
||||
{
|
||||
if (_player.getBytesTotal() > 0)
|
||||
{
|
||||
var bytesLoaded:Float = _player.getBytesLoaded();
|
||||
var bytesTotal:Float = _player.getBytesTotal();
|
||||
|
||||
_percentLoaded = bytesLoaded / bytesTotal;
|
||||
}
|
||||
|
||||
var position:Float = _player.getStartTime() / _player.getDuration();
|
||||
var startPosition:Float = (position > 0?(position * _track.width):0) + _track.x;
|
||||
|
||||
_trackDownloaded.graphics.clear();
|
||||
_trackDownloaded.graphics.lineStyle();
|
||||
_trackDownloaded.x = startPosition;
|
||||
_trackDownloaded.graphics.beginFill(_seekColor, 0.5);
|
||||
_trackDownloaded.graphics.drawRoundRect(0, (_seekBar.height / 2) - (5 / 2), ((_track.width + _track.x) - _trackDownloaded.x) * _percentLoaded, 5, 3, 3);
|
||||
_trackDownloaded.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws NEW control bar player/seek controls
|
||||
*/
|
||||
private function drawControls():Void
|
||||
{
|
||||
//Reset sprites for redraw
|
||||
_controlsBar.graphics.clear();
|
||||
_volumeTrack.graphics.clear();
|
||||
_volumeSlider.graphics.clear();
|
||||
_volumeSlider.visible = false;
|
||||
_volumeTrack.visible = false;
|
||||
|
||||
//Reset sprites for redraw
|
||||
_seekBar.graphics.clear();
|
||||
_track.graphics.clear();
|
||||
_thumb.graphics.clear();
|
||||
|
||||
//Draw controls bar
|
||||
var barMargin = 10;
|
||||
var barWidth = _stage.stageWidth;
|
||||
var barHeight = _controlSize;
|
||||
var barCenter = barWidth / 2;
|
||||
var buttonSize = Std.int(((80 / 100) * (barHeight - (barMargin*2))));
|
||||
|
||||
_controlsBar.x = 0;
|
||||
_controlsBar.y = (_stage.stageHeight - barHeight);
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(barWidth, barHeight, Utils.degreesToRadians(-90), barWidth, 0);
|
||||
var colors:Array<UInt> = [_brightColor, _darkColor];
|
||||
var alphas:Array<Float> = [1.0, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
_controlsBar.graphics.lineStyle();
|
||||
_controlsBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
_controlsBar.graphics.drawRect(0, 2, barWidth, barHeight-2);
|
||||
_controlsBar.graphics.endFill();
|
||||
_controlsBar.graphics.beginFill(_darkColor, 1);
|
||||
_controlsBar.graphics.drawRect(0, 0, barWidth, 1);
|
||||
_controlsBar.graphics.endFill();
|
||||
_controlsBar.graphics.beginFill(_brightColor, 1);
|
||||
_controlsBar.graphics.drawRect(0, 1, barWidth, 1);
|
||||
_controlsBar.graphics.endFill();
|
||||
|
||||
//Draw seek bar
|
||||
var _seekBarWidth = barWidth - (buttonSize+barMargin)*3 - (_playControl.x + _playControl.width + barMargin) - barMargin;
|
||||
var _seekBarHeight = barHeight;
|
||||
_seekBar.x = _playControl.x + _playControl.width + barMargin;
|
||||
_seekBar.y = 0;
|
||||
_seekBar.graphics.lineStyle();
|
||||
_seekBar.graphics.beginFill(_darkColor, 0);
|
||||
_seekBar.graphics.drawRect(0, 0, _seekBarWidth, _seekBarHeight);
|
||||
_seekBar.graphics.endFill();
|
||||
|
||||
//Draw playbutton
|
||||
_playControl.setNormalColor(_controlColor);
|
||||
_playControl.setHoverColor(_hoverColor);
|
||||
_playControl.setPosition(barMargin, barMargin);
|
||||
_playControl.setSize(buttonSize+5, buttonSize+5);
|
||||
|
||||
//Draw pausebutton
|
||||
_pauseControl.setNormalColor(_controlColor);
|
||||
_pauseControl.setHoverColor(_hoverColor);
|
||||
_pauseControl.setPosition(_playControl.x, _playControl.y);
|
||||
_pauseControl.setSize(buttonSize+5, buttonSize+5);
|
||||
|
||||
//Draw current play time label
|
||||
_textFormat.color = _seekColor;
|
||||
_currentPlayTimeLabel.x = 0;
|
||||
_currentPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_currentPlayTimeLabel.height / 2);
|
||||
_currentPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw total play time label
|
||||
_totalPlayTimeLabel.x = _seekBarWidth - _totalPlayTimeLabel.width;
|
||||
_totalPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_totalPlayTimeLabel.height / 2);
|
||||
_totalPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw download progress
|
||||
drawDownloadProgress();
|
||||
|
||||
//Draw track place holder for drag
|
||||
_track.x = _currentPlayTimeLabel.x + _currentPlayTimeLabel.width + barMargin;
|
||||
_track.graphics.lineStyle();
|
||||
_track.graphics.beginFill(_seekColor, 0);
|
||||
_track.graphics.drawRect(0, (_seekBarHeight / 2) - ((buttonSize+barMargin) / 2), _totalPlayTimeLabel.x - _totalPlayTimeLabel.width - barMargin - barMargin, buttonSize + barMargin);
|
||||
_track.graphics.endFill();
|
||||
|
||||
_track.graphics.lineStyle();
|
||||
_track.graphics.beginFill(_seekColor, 0.3);
|
||||
_track.graphics.drawRoundRect(0, (_seekBarHeight / 2) - (5 / 2), _totalPlayTimeLabel.x - _totalPlayTimeLabel.width - barMargin - barMargin, 5, 3, 3);
|
||||
_track.graphics.endFill();
|
||||
|
||||
//Draw thumb
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(11, 11, Utils.degreesToRadians(-90), 11, 0);
|
||||
var colors:Array<UInt> = [_controlColor, _controlColor];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
_thumb.x = _currentPlayTimeLabel.width + _currentPlayTimeLabel.x + barMargin;
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//_thumb.graphics.beginFill(_controlColor);
|
||||
_thumb.graphics.drawRoundRect(0, (_seekBarHeight/2)-(11/2), 11, 11, 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
|
||||
//Draw volume icon
|
||||
_volumeIcon.setNormalColor(_controlColor);
|
||||
_volumeIcon.setHoverColor(_hoverColor);
|
||||
_volumeIcon.setPosition(_seekBar.x + _seekBar.width + barMargin, _playControl.y+1);
|
||||
_volumeIcon.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw aspec ratio button
|
||||
_aspectRatioControl.setNormalColor(_controlColor);
|
||||
_aspectRatioControl.setHoverColor(_hoverColor);
|
||||
_aspectRatioControl.setPosition(_volumeIcon.x + _volumeIcon.width + barMargin, _playControl.y+1);
|
||||
_aspectRatioControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw fullscreen button
|
||||
_fullscreenControl.setNormalColor(_controlColor);
|
||||
_fullscreenControl.setHoverColor(_hoverColor);
|
||||
_fullscreenControl.setPosition(_aspectRatioControl.x + _aspectRatioControl.width + barMargin, _playControl.y+1);
|
||||
_fullscreenControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw volume track
|
||||
_volumeTrack.x = _controlsBar.width-(buttonSize+barMargin)*3;
|
||||
_volumeTrack.y = -_controlsBar.height-2;
|
||||
_volumeTrack.graphics.lineStyle(1, _controlColor);
|
||||
_volumeTrack.graphics.beginFill(0x000000, 0);
|
||||
_volumeTrack.graphics.drawRect(0, 0, buttonSize, _controlsBar.height);
|
||||
_volumeTrack.graphics.endFill();
|
||||
|
||||
//Draw volume slider
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_volumeTrack.width, _volumeTrack.height, Utils.degreesToRadians(-90), _volumeTrack.width, 0);
|
||||
var colors:Array<UInt> = [_hoverColor, _hoverColor];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
_volumeSlider.x = _volumeTrack.x;
|
||||
_volumeSlider.y = _volumeTrack.y;
|
||||
_volumeSlider.graphics.lineStyle();
|
||||
_volumeSlider.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//_volumeSlider.graphics.beginFill(_hoverColor, 1);
|
||||
_volumeSlider.graphics.drawRect(0, 0, _volumeTrack.width, _volumeTrack.height);
|
||||
_volumeSlider.graphics.endFill();
|
||||
|
||||
}
|
||||
|
||||
private function drawAspectRatioLabel():Void
|
||||
{
|
||||
_aspectRatioLabelContainer.graphics.clear();
|
||||
_aspectRatioLabelContainer.visible = false;
|
||||
|
||||
//Update aspect ratio label
|
||||
var textFormat:TextFormat = new TextFormat();
|
||||
textFormat.font = "arial";
|
||||
textFormat.bold = true;
|
||||
textFormat.size = 40;
|
||||
textFormat.color = _controlColor;
|
||||
|
||||
_aspectRatioLabel.setTextFormat(textFormat);
|
||||
_aspectRatioLabel.x = (_stage.stageWidth / 2) - (_aspectRatioLabel.width / 2);
|
||||
_aspectRatioLabel.y = (_stage.stageHeight / 2) - (_aspectRatioLabel.height / 2);
|
||||
|
||||
//Draw aspect ratio label container
|
||||
_aspectRatioLabelContainer.x = _aspectRatioLabel.x - 10;
|
||||
_aspectRatioLabelContainer.y = _aspectRatioLabel.y - 10;
|
||||
_aspectRatioLabelContainer.graphics.lineStyle(0, _darkColor);
|
||||
_aspectRatioLabelContainer.graphics.beginFill(_darkColor, 1);
|
||||
_aspectRatioLabelContainer.graphics.drawRoundRect(0, 0, _aspectRatioLabel.width + 20, _aspectRatioLabel.height + 20, 15, 15);
|
||||
_aspectRatioLabelContainer.graphics.endFill();
|
||||
|
||||
_aspectRatioLabel.x = 10;
|
||||
_aspectRatioLabel.y = 10;
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Private Methods
|
||||
/**
|
||||
* Hide the play controls bar
|
||||
*/
|
||||
private function hideControls():Void
|
||||
{
|
||||
if(_controlsBar.visible)
|
||||
{
|
||||
drawControls();
|
||||
Animation.slideOut(_controlsBar, "bottom", 800);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows play controls bar
|
||||
*/
|
||||
private function showControls():Void
|
||||
{
|
||||
if(!_controlsBar.visible)
|
||||
{
|
||||
drawControls();
|
||||
_controlsBar.visible = true;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Setters
|
||||
/**
|
||||
* Sets the player colors and redraw them
|
||||
* @param colors Array of colors in the following order: darkColor, brightColor, controlColor, hoverColor
|
||||
*/
|
||||
public function setControlColors(colors:Array<String>):Void
|
||||
{
|
||||
_darkColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x000000;
|
||||
_brightColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0x4c4c4c;
|
||||
_controlColor = colors[2].length > 0? Std.parseInt("0x" + colors[2]) : 0xFFFFFF;
|
||||
_hoverColor = colors[3].length > 0? Std.parseInt("0x" + colors[3]) : 0x67A8C1;
|
||||
_seekColor = colors[4].length > 0? Std.parseInt("0x" + colors[4]) : 0x7c7c7c;
|
||||
|
||||
|
||||
var loaderColors:Array <String> = ["", ""];
|
||||
loaderColors[0] = colors[0];
|
||||
loaderColors[1] = colors[2];
|
||||
loaderColors[2] = colors[4];
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the player controls size (height)
|
||||
* @param size int: for e.g. 50
|
||||
*/
|
||||
public function setControlSize(size:Int):Void
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
_controlSize = size;
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* To set the duration label when autostart parameter is false
|
||||
* @param duration in seconds or formatted string in format hh:mm:ss
|
||||
*/
|
||||
public function setDurationLabel(duration:String):Void
|
||||
{
|
||||
//Person passed time already formatted
|
||||
if (duration.indexOf(":") != -1)
|
||||
{
|
||||
_totalPlayTimeLabel.text = duration;
|
||||
}
|
||||
|
||||
//Time passed in seconds
|
||||
else
|
||||
{
|
||||
_totalPlayTimeLabel.text = Std.string(Utils.formatTime(Std.parseFloat(duration)));
|
||||
}
|
||||
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import jaris.utils.Utils;
|
||||
import flash.display.GradientType;
|
||||
|
||||
class PauseIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle(0, color, 0.0);
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
|
||||
var colors:Array<UInt> = [color, color];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//graphics.beginFill(color);
|
||||
graphics.drawRoundRect(0, 0, (33 / 100) * _width, _height, 6, 6);
|
||||
graphics.drawRoundRect(_width - ((33 / 100) * _width), 0, (33 / 100) * _width, _height, 6, 6);
|
||||
graphics.endFill();
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import jaris.utils.Utils;
|
||||
import flash.display.GradientType;
|
||||
|
||||
class PlayIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
graphics.lineStyle(0, color, 0.0);
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
|
||||
var colors:Array<UInt> = [color, color];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//graphics.beginFill(color);
|
||||
graphics.lineTo(0, _height);
|
||||
graphics.lineTo(_width, _height / 2);
|
||||
graphics.lineTo(0, 0);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player.newcontrols;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import jaris.utils.Utils;
|
||||
import flash.display.GradientType;
|
||||
|
||||
class VolumeIcon extends Sprite
|
||||
{
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _normalColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
|
||||
public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
|
||||
{
|
||||
super();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.tabEnabled = false;
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_normalColor = normalColor;
|
||||
_hoverColor = hoverColor;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
private function onMouseOver(event:MouseEvent):Void
|
||||
{
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
private function onMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
//{Private Methods
|
||||
private function draw(color:UInt):Void
|
||||
{
|
||||
graphics.clear();
|
||||
|
||||
graphics.lineStyle(0, color, 0.0);
|
||||
graphics.beginFill(color, 0);
|
||||
graphics.drawRect(0, 0, _width, _height);
|
||||
graphics.endFill();
|
||||
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
|
||||
var colors:Array<UInt> = [color, color];
|
||||
var alphas:Array<Float> = [0.75, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
|
||||
graphics.lineStyle();
|
||||
graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//graphics.beginFill(color, 1);
|
||||
graphics.drawRect(0, ((50 / 100) * _height) / 2+1, _width / 2-1, ((50 / 100) * _height));
|
||||
graphics.moveTo(_width / 2 -1, ((50 / 100) * _height)/2+1);
|
||||
graphics.lineTo(_width, 0);
|
||||
graphics.lineTo(_width, _height+2);
|
||||
graphics.lineTo(_width / 2 -1, ((50 / 100) * _height) + (((50 / 100) * _height) / 2)+1);
|
||||
graphics.endFill();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Setters
|
||||
public function setNormalColor(color:UInt):Void
|
||||
{
|
||||
_normalColor = color;
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setHoverColor(color:UInt):Void
|
||||
{
|
||||
_hoverColor = color;
|
||||
draw(_hoverColor);
|
||||
}
|
||||
|
||||
public function setPosition(x:Float, y:Float):Void
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float):Void
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
draw(_normalColor);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.utils;
|
||||
|
||||
/**
|
||||
* Some utility functions
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
|
||||
/**
|
||||
* Converts degrees to radians for easy rotation where applicable
|
||||
* @param value A radian value to convert
|
||||
* @return conversion of degree to radian
|
||||
*/
|
||||
public static function degreesToRadians(value:Float):Float
|
||||
{
|
||||
return (Math.PI / 180) * value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a float value representing seconds to a readale string
|
||||
* @param time A given time in seconds
|
||||
* @return A string in the format 00:00:00
|
||||
*/
|
||||
public static function formatTime(time:Float):String
|
||||
{
|
||||
var seconds:String = "";
|
||||
var minutes:String = "";
|
||||
var hours:String = "";
|
||||
var timeString:String = "";
|
||||
|
||||
if (((time / 60) / 60) >= 1)
|
||||
{
|
||||
if (Math.floor((time / 60)) / 60 < 10)
|
||||
{
|
||||
hours = "0" + Math.floor((time / 60) / 60) + ":";
|
||||
}
|
||||
else
|
||||
{
|
||||
hours = Math.floor((time / 60) / 60) + ":";
|
||||
}
|
||||
|
||||
if (Math.floor((time / 60) % 60) < 10)
|
||||
{
|
||||
minutes = "0" + Math.floor((time / 60) % 60) + ":";
|
||||
}
|
||||
else
|
||||
{
|
||||
minutes = Math.floor((time / 60) % 60) + ":";
|
||||
}
|
||||
|
||||
if (Math.floor(time % 60) < 10)
|
||||
{
|
||||
seconds = "0" + Math.floor(time % 60);
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = Std.string(Math.floor(time % 60));
|
||||
}
|
||||
}
|
||||
else if((time / 60) >= 1)
|
||||
{
|
||||
hours = "00:";
|
||||
|
||||
if (Math.floor(time / 60) < 10)
|
||||
{
|
||||
minutes = "0" + Math.floor(time / 60) + ":";
|
||||
}
|
||||
else
|
||||
{
|
||||
minutes = Math.floor(time / 60) + ":";
|
||||
}
|
||||
|
||||
if (Math.floor(time % 60) < 10)
|
||||
{
|
||||
seconds = "0" + Math.floor(time % 60);
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = Std.string(Math.floor(time % 60));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hours = "00:";
|
||||
|
||||
minutes = "00:";
|
||||
|
||||
if (Math.floor(time) < 10)
|
||||
{
|
||||
seconds = "0" + Math.floor(time);
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = Std.string(Math.floor(time));
|
||||
}
|
||||
}
|
||||
|
||||
timeString += hours + minutes + seconds;
|
||||
|
||||
return timeString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given rtmp source to a valid format for NetStream
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static function rtmpSourceParser(source:String):String
|
||||
{
|
||||
if (source.indexOf(".flv") != -1)
|
||||
{
|
||||
return source.split(".flv").join("");
|
||||
}
|
||||
else if (source.indexOf(".mp3") != -1)
|
||||
{
|
||||
return "mp3:" + source.split(".mp3").join("");
|
||||
}
|
||||
else if (source.indexOf(".mp4") != -1)
|
||||
{
|
||||
return "mp4:" + source;
|
||||
}
|
||||
else if (source.indexOf(".f4v") != -1)
|
||||
{
|
||||
return "mp4:" + source;
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes a youtube url to the format youtube.com/v/video_id
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static function youtubeSourceParse(source:String):String
|
||||
{
|
||||
return source.split("watch?v=").join("v/");
|
||||
}
|
||||
}
|
|
@ -1,356 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* 01.26.2006 12:29:28est
|
||||
*
|
||||
* Akismet PHP4 class
|
||||
*
|
||||
* <b>Usage</b>
|
||||
* <code>
|
||||
* $comment = array(
|
||||
* 'author' => 'viagra-test-123',
|
||||
* 'email' => 'test@example.com',
|
||||
* 'website' => 'http://www.example.com/',
|
||||
* 'body' => 'This is a test comment',
|
||||
* 'permalink' => 'http://yourdomain.com/yourblogpost.url',
|
||||
* );
|
||||
*
|
||||
* $akismet = new Akismet('http://www.yourdomain.com/', 'YOUR_WORDPRESS_API_KEY', $comment);
|
||||
*
|
||||
* if($akismet->isError()) {
|
||||
* echo"Couldn't connected to Akismet server!";
|
||||
* } else {
|
||||
* if($akismet->isSpam()) {
|
||||
* echo"Spam detected";
|
||||
* } else {
|
||||
* echo"yay, no spam!";
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @author Bret Kuhns {@link www.miphp.net}
|
||||
* @link http://www.miphp.net/blog/view/php4_akismet_class/
|
||||
* @version 0.3.3
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Error constants
|
||||
define("AKISMET_SERVER_NOT_FOUND", 0);
|
||||
define("AKISMET_RESPONSE_FAILED", 1);
|
||||
define("AKISMET_INVALID_KEY", 2);
|
||||
|
||||
|
||||
|
||||
// Base class to assist in error handling between Akismet classes
|
||||
class AkismetObject {
|
||||
var $errors = array();
|
||||
|
||||
|
||||
/**
|
||||
* Add a new error to the errors array in the object
|
||||
*
|
||||
* @param String $name A name (array key) for the error
|
||||
* @param String $string The error message
|
||||
* @return void
|
||||
*/
|
||||
// Set an error in the object
|
||||
function setError($name, $message) {
|
||||
$this->errors[$name] = $message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a specific error message from the errors array
|
||||
*
|
||||
* @param String $name The name of the error you want
|
||||
* @return mixed Returns a String if the error exists, a false boolean if it does not exist
|
||||
*/
|
||||
function getError($name) {
|
||||
if($this->isError($name)) {
|
||||
return $this->errors[$name];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all errors in the object
|
||||
*
|
||||
* @return String[]
|
||||
*/
|
||||
function getErrors() {
|
||||
return (array)$this->errors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a certain error exists
|
||||
*
|
||||
* @param String $name The name of the error you want
|
||||
* @return boolean
|
||||
*/
|
||||
function isError($name) {
|
||||
return isset($this->errors[$name]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if any errors exist
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function errorsExist() {
|
||||
return (count($this->errors) > 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Used by the Akismet class to communicate with the Akismet service
|
||||
class AkismetHttpClient extends AkismetObject {
|
||||
var $akismetVersion = '1.1';
|
||||
var $con;
|
||||
var $host;
|
||||
var $port;
|
||||
var $apiKey;
|
||||
var $blogUrl;
|
||||
var $errors = array();
|
||||
|
||||
|
||||
// Constructor
|
||||
function __construct($host, $blogUrl, $apiKey, $port = 80) {
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->blogUrl = $blogUrl;
|
||||
$this->apiKey = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// Use the connection active in $con to get a response from the server and return that response
|
||||
function getResponse($request, $path, $type = "post", $responseLength = 1160) {
|
||||
$this->_connect();
|
||||
|
||||
if($this->con && !$this->isError(AKISMET_SERVER_NOT_FOUND)) {
|
||||
$request =
|
||||
strToUpper($type)." /{$this->akismetVersion}/$path HTTP/1.1\r\n" .
|
||||
"Host: ".((!empty($this->apiKey)) ? $this->apiKey."." : null)."{$this->host}\r\n" .
|
||||
"Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" .
|
||||
"Content-Length: ".strlen($request)."\r\n" .
|
||||
"User-Agent: Akismet PHP4 Class\r\n" .
|
||||
"\r\n" .
|
||||
$request
|
||||
;
|
||||
$response = "";
|
||||
|
||||
@fwrite($this->con, $request);
|
||||
|
||||
while(!feof($this->con)) {
|
||||
$response .= @fgets($this->con, $responseLength);
|
||||
}
|
||||
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
return $response[1];
|
||||
} else {
|
||||
$this->setError(AKISMET_RESPONSE_FAILED, "The response could not be retrieved.");
|
||||
}
|
||||
|
||||
$this->_disconnect();
|
||||
}
|
||||
|
||||
|
||||
// Connect to the Akismet server and store that connection in the instance variable $con
|
||||
function _connect() {
|
||||
if(!($this->con = @fsockopen($this->host, $this->port))) {
|
||||
$this->setError(AKISMET_SERVER_NOT_FOUND, "Could not connect to akismet server.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Close the connection to the Akismet server
|
||||
function _disconnect() {
|
||||
@fclose($this->con);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// The controlling class. This is the ONLY class the user should instantiate in
|
||||
// order to use the Akismet service!
|
||||
class Akismet extends AkismetObject {
|
||||
var $apiPort = 80;
|
||||
var $akismetServer = 'rest.akismet.com';
|
||||
var $akismetVersion = '1.1';
|
||||
var $http;
|
||||
|
||||
var $ignore = array(
|
||||
'HTTP_COOKIE',
|
||||
'HTTP_X_FORWARDED_FOR',
|
||||
'HTTP_X_FORWARDED_HOST',
|
||||
'HTTP_MAX_FORWARDS',
|
||||
'HTTP_X_FORWARDED_SERVER',
|
||||
'REDIRECT_STATUS',
|
||||
'SERVER_PORT',
|
||||
'PATH',
|
||||
'DOCUMENT_ROOT',
|
||||
'SERVER_ADMIN',
|
||||
'QUERY_STRING',
|
||||
'PHP_SELF'
|
||||
);
|
||||
|
||||
var $blogUrl = "";
|
||||
var $apiKey = "";
|
||||
var $comment = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Set instance variables, connect to Akismet, and check API key
|
||||
*
|
||||
* @param String $blogUrl The URL to your own blog
|
||||
* @param String $apiKey Your wordpress API key
|
||||
* @param String[] $comment A formatted comment array to be examined by the Akismet service
|
||||
*/
|
||||
function __construct($blogUrl, $apiKey, $comment) {
|
||||
$this->blogUrl = $blogUrl;
|
||||
$this->apiKey = $apiKey;
|
||||
|
||||
// Populate the comment array with information needed by Akismet
|
||||
$this->comment = $comment;
|
||||
$this->_formatCommentArray();
|
||||
|
||||
if(!isset($this->comment['user_ip'])) {
|
||||
$this->comment['user_ip'] = ($_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) ? $_SERVER['REMOTE_ADDR'] : getenv('HTTP_X_FORWARDED_FOR');
|
||||
}
|
||||
if(!isset($this->comment['user_agent'])) {
|
||||
$this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||
}
|
||||
if(!isset($this->comment['referrer'])) {
|
||||
$this->comment['referrer'] = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
$this->comment['blog'] = $blogUrl;
|
||||
|
||||
// Connect to the Akismet server and populate errors if they exist
|
||||
$this->http = new AkismetHttpClient($this->akismetServer, $blogUrl, $apiKey);
|
||||
if($this->http->errorsExist()) {
|
||||
$this->errors = array_merge($this->errors, $this->http->getErrors());
|
||||
}
|
||||
|
||||
// Check if the API key is valid
|
||||
if(!$this->_isValidApiKey($apiKey)) {
|
||||
$this->setError(AKISMET_INVALID_KEY, "Your Akismet API key is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Query the Akismet and determine if the comment is spam or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isSpam() {
|
||||
$response = $this->http->getResponse($this->_getQueryString(), 'comment-check');
|
||||
|
||||
return ($response == "true");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submit this comment as an unchecked spam to the Akismet server
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function submitSpam() {
|
||||
$this->http->getResponse($this->_getQueryString(), 'submit-spam');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submit a false-positive comment as "ham" to the Akismet server
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function submitHam() {
|
||||
$this->http->getResponse($this->_getQueryString(), 'submit-ham');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check with the Akismet server to determine if the API key is valid
|
||||
*
|
||||
* @access Protected
|
||||
* @param String $key The Wordpress API key passed from the constructor argument
|
||||
* @return boolean
|
||||
*/
|
||||
function _isValidApiKey($key) {
|
||||
$keyCheck = $this->http->getResponse("key=".$this->apiKey."&blog=".$this->blogUrl, 'verify-key');
|
||||
|
||||
return ($keyCheck == "valid");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format the comment array in accordance to the Akismet API
|
||||
*
|
||||
* @access Protected
|
||||
* @return void
|
||||
*/
|
||||
function _formatCommentArray() {
|
||||
$format = array(
|
||||
'type' => 'comment_type',
|
||||
'author' => 'comment_author',
|
||||
'email' => 'comment_author_email',
|
||||
'website' => 'comment_author_url',
|
||||
'body' => 'comment_content'
|
||||
);
|
||||
|
||||
foreach($format as $short => $long) {
|
||||
if(isset($this->comment[$short])) {
|
||||
$this->comment[$long] = $this->comment[$short];
|
||||
unset($this->comment[$short]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a query string for use with HTTP requests
|
||||
*
|
||||
* @access Protected
|
||||
* @return String
|
||||
*/
|
||||
function _getQueryString() {
|
||||
foreach($_SERVER as $key => $value) {
|
||||
if(!in_array($key, $this->ignore)) {
|
||||
if($key == 'REMOTE_ADDR') {
|
||||
$this->comment[$key] = $this->comment['user_ip'];
|
||||
} else {
|
||||
$this->comment[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query_string = '';
|
||||
|
||||
foreach($this->comment as $key => $data) {
|
||||
if(is_string($data)) {
|
||||
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
|
||||
}
|
||||
}
|
||||
|
||||
return $query_string;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,269 +0,0 @@
|
|||
<?php
|
||||
|
||||
interface Flexihash_Hasher
|
||||
{
|
||||
public function hash($string);
|
||||
}
|
||||
|
||||
class Flexihash_Crc32Hasher
|
||||
implements Flexihash_Hasher
|
||||
{
|
||||
|
||||
public function hash($string)
|
||||
{
|
||||
return crc32($string);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Flexihash_Exception extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A simple consistent hashing implementation with pluggable hash algorithms.
|
||||
*
|
||||
* @author Paul Annesley
|
||||
* @package Flexihash
|
||||
* @licence http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
class Flexihash
|
||||
{
|
||||
|
||||
/**
|
||||
* The number of positions to hash each target to.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_replicas = 64;
|
||||
|
||||
/**
|
||||
* The hash algorithm, encapsulated in a Flexihash_Hasher implementation.
|
||||
* @var object Flexihash_Hasher
|
||||
*/
|
||||
private $_hasher;
|
||||
|
||||
/**
|
||||
* Internal counter for current number of targets.
|
||||
* @var int
|
||||
*/
|
||||
private $_targetCount = 0;
|
||||
|
||||
/**
|
||||
* Internal map of positions (hash outputs) to targets
|
||||
* @var array { position => target, ... }
|
||||
*/
|
||||
private $_positionToTarget = array();
|
||||
|
||||
/**
|
||||
* Internal map of targets to lists of positions that target is hashed to.
|
||||
* @var array { target => [ position, position, ... ], ... }
|
||||
*/
|
||||
private $_targetToPositions = array();
|
||||
|
||||
/**
|
||||
* Whether the internal map of positions to targets is already sorted.
|
||||
* @var boolean
|
||||
*/
|
||||
private $_positionToTargetSorted = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param object $hasher Flexihash_Hasher
|
||||
* @param int $replicas Amount of positions to hash each target to.
|
||||
*/
|
||||
public function __construct(Flexihash_Hasher $hasher = null, $replicas = null)
|
||||
{
|
||||
$this->_hasher = $hasher ? $hasher : new Flexihash_Crc32Hasher();
|
||||
if (!empty($replicas)) $this->_replicas = $replicas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a target.
|
||||
* @param string $target
|
||||
* @param float $weight
|
||||
* @chainable
|
||||
*/
|
||||
public function addTarget($target, $weight=1)
|
||||
{
|
||||
if (isset($this->_targetToPositions[$target]))
|
||||
{
|
||||
throw new Flexihash_Exception("Target '$target' already exists.");
|
||||
}
|
||||
|
||||
$this->_targetToPositions[$target] = array();
|
||||
|
||||
// hash the target into multiple positions
|
||||
for ($i = 0; $i < round($this->_replicas*$weight); $i++)
|
||||
{
|
||||
$position = $this->_hasher->hash($target . $i);
|
||||
$this->_positionToTarget[$position] = $target; // lookup
|
||||
$this->_targetToPositions[$target] []= $position; // target removal
|
||||
}
|
||||
|
||||
$this->_positionToTargetSorted = false;
|
||||
$this->_targetCount++;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a list of targets.
|
||||
* @param array $targets
|
||||
* @param float $weight
|
||||
* @chainable
|
||||
*/
|
||||
public function addTargets($targets, $weight=1)
|
||||
{
|
||||
foreach ($targets as $target)
|
||||
{
|
||||
$this->addTarget($target,$weight);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a target.
|
||||
* @param string $target
|
||||
* @chainable
|
||||
*/
|
||||
public function removeTarget($target)
|
||||
{
|
||||
if (!isset($this->_targetToPositions[$target]))
|
||||
{
|
||||
throw new Flexihash_Exception("Target '$target' does not exist.");
|
||||
}
|
||||
|
||||
foreach ($this->_targetToPositions[$target] as $position)
|
||||
{
|
||||
unset($this->_positionToTarget[$position]);
|
||||
}
|
||||
|
||||
unset($this->_targetToPositions[$target]);
|
||||
|
||||
$this->_targetCount--;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of all potential targets
|
||||
* @return array
|
||||
*/
|
||||
public function getAllTargets()
|
||||
{
|
||||
return array_keys($this->_targetToPositions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the target for the given resource.
|
||||
* @param string $resource
|
||||
* @return string
|
||||
*/
|
||||
public function lookup($resource)
|
||||
{
|
||||
$targets = $this->lookupList($resource, 1);
|
||||
if (empty($targets)) throw new Flexihash_Exception('No targets exist');
|
||||
return $targets[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of targets for the resource, in order of precedence.
|
||||
* Up to $requestedCount targets are returned, less if there are fewer in total.
|
||||
*
|
||||
* @param string $resource
|
||||
* @param int $requestedCount The length of the list to return
|
||||
* @return array List of targets
|
||||
*/
|
||||
public function lookupList($resource, $requestedCount)
|
||||
{
|
||||
if (!$requestedCount)
|
||||
throw new Flexihash_Exception('Invalid count requested');
|
||||
|
||||
// handle no targets
|
||||
if (empty($this->_positionToTarget))
|
||||
return array();
|
||||
|
||||
// optimize single target
|
||||
if ($this->_targetCount == 1)
|
||||
return array_unique(array_values($this->_positionToTarget));
|
||||
|
||||
// hash resource to a position
|
||||
$resourcePosition = $this->_hasher->hash($resource);
|
||||
|
||||
$results = array();
|
||||
$collect = false;
|
||||
|
||||
$this->_sortPositionTargets();
|
||||
|
||||
// search values above the resourcePosition
|
||||
foreach ($this->_positionToTarget as $key => $value)
|
||||
{
|
||||
// start collecting targets after passing resource position
|
||||
if (!$collect && $key > $resourcePosition)
|
||||
{
|
||||
$collect = true;
|
||||
}
|
||||
|
||||
// only collect the first instance of any target
|
||||
if ($collect && !in_array($value, $results))
|
||||
{
|
||||
$results []= $value;
|
||||
}
|
||||
|
||||
// return when enough results, or list exhausted
|
||||
if (count($results) == $requestedCount || count($results) == $this->_targetCount)
|
||||
{
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
// loop to start - search values below the resourcePosition
|
||||
foreach ($this->_positionToTarget as $key => $value)
|
||||
{
|
||||
if (!in_array($value, $results))
|
||||
{
|
||||
$results []= $value;
|
||||
}
|
||||
|
||||
// return when enough results, or list exhausted
|
||||
if (count($results) == $requestedCount || count($results) == $this->_targetCount)
|
||||
{
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
// return results after iterating through both "parts"
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return sprintf(
|
||||
'%s{targets:[%s]}',
|
||||
get_class($this),
|
||||
implode(',', $this->getAllTargets())
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// private methods
|
||||
|
||||
/**
|
||||
* Sorts the internal mapping (positions to targets) by position
|
||||
*/
|
||||
private function _sortPositionTargets()
|
||||
{
|
||||
// sort by key (position) if not already
|
||||
if (!$this->_positionToTargetSorted)
|
||||
{
|
||||
ksort($this->_positionToTarget, SORT_REGULAR);
|
||||
$this->_positionToTargetSorted = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
4
lib/jquery-1.11.0.min.js
vendored
4
lib/jquery-1.11.0.min.js
vendored
File diff suppressed because one or more lines are too long
6
lib/jquery-ui-1.10.4.custom.min.js
vendored
6
lib/jquery-ui-1.10.4.custom.min.js
vendored
File diff suppressed because one or more lines are too long
7
lib/jquery.autocomplete-2.4.4.min.css
vendored
7
lib/jquery.autocomplete-2.4.4.min.css
vendored
|
@ -1,7 +0,0 @@
|
|||
/**
|
||||
* @fileOverview CSS for jquery-autocomplete, the jQuery Autocompleter
|
||||
* @author <a href="mailto:dylan@dyve.net">Dylan Verheul</a>
|
||||
* @license MIT | GPL | Apache 2.0, see LICENSE.txt
|
||||
* @see https://github.com/dyve/jquery-autocomplete
|
||||
*/
|
||||
.acResults{padding:0;border:1px solid WindowFrame;background-color:Window;overflow:hidden}.acResults ul{margin:0;padding:0;list-style-position:outside;list-style:none}.acResults ul li{margin:0;padding:2px 5px;cursor:pointer;display:block;font:menu;font-size:12px;overflow:hidden}.acLoading{background:url(indicator.gif) right center no-repeat}.acSelect{background-color:Highlight;color:HighlightText}
|
9
lib/jquery.autocomplete-2.4.4.min.js
vendored
9
lib/jquery.autocomplete-2.4.4.min.js
vendored
File diff suppressed because one or more lines are too long
2
lib/jquery.tablesorter-2.0.5.min.js
vendored
2
lib/jquery.tablesorter-2.0.5.min.js
vendored
File diff suppressed because one or more lines are too long
17
lib/jquery.timeago-1.3.1.min.js
vendored
17
lib/jquery.timeago-1.3.1.min.js
vendored
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* Timeago is a jQuery plugin that makes it easy to support automatically
|
||||
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
|
||||
*
|
||||
* @name timeago
|
||||
* @version 1.3.1
|
||||
* @requires jQuery v1.2.3+
|
||||
* @author Ryan McGeary
|
||||
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* For usage and examples, visit:
|
||||
* http://timeago.yarp.com/
|
||||
*
|
||||
* Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
|
||||
*/
|
||||
|
||||
(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){function r(){var n=i(this);var r=t.settings;if(!isNaN(n.datetime)){if(r.cutoff==0||o(n.datetime)<r.cutoff){e(this).text(s(n.datetime))}}return this}function i(n){n=e(n);if(!n.data("timeago")){n.data("timeago",{datetime:t.datetime(n)});var r=e.trim(n.text());if(t.settings.localeTitle){n.attr("title",n.data("timeago").datetime.toLocaleString())}else if(r.length>0&&!(t.isTime(n)&&n.attr("title"))){n.attr("title",r)}}return n.data("timeago")}function s(e){return t.inWords(o(e))}function o(e){return(new Date).getTime()-e.getTime()}e.timeago=function(t){if(t instanceof Date){return s(t)}else if(typeof t==="string"){return s(e.timeago.parse(t))}else if(typeof t==="number"){return s(new Date(t))}else{return s(e.timeago.datetime(t))}};var t=e.timeago;e.extend(e.timeago,{settings:{refreshMillis:6e4,allowFuture:false,localeTitle:false,cutoff:0,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",wordSeparator:" ",numbers:[]}},inWords:function(t){function l(r,i){var s=e.isFunction(r)?r(i,t):r;var o=n.numbers&&n.numbers[i]||i;return s.replace(/%d/i,o)}var n=this.settings.strings;var r=n.prefixAgo;var i=n.suffixAgo;if(this.settings.allowFuture){if(t<0){r=n.prefixFromNow;i=n.suffixFromNow}}var s=Math.abs(t)/1e3;var o=s/60;var u=o/60;var a=u/24;var f=a/365;var c=s<45&&l(n.seconds,Math.round(s))||s<90&&l(n.minute,1)||o<45&&l(n.minutes,Math.round(o))||o<90&&l(n.hour,1)||u<24&&l(n.hours,Math.round(u))||u<42&&l(n.day,1)||a<30&&l(n.days,Math.round(a))||a<45&&l(n.month,1)||a<365&&l(n.months,Math.round(a/30))||f<1.5&&l(n.year,1)||l(n.years,Math.round(f));var h=n.wordSeparator||"";if(n.wordSeparator===undefined){h=" "}return e.trim([r,c,i].join(h))},parse:function(t){var n=e.trim(t);n=n.replace(/\.\d+/,"");n=n.replace(/-/,"/").replace(/-/,"/");n=n.replace(/T/," ").replace(/Z/," UTC");n=n.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2");return new Date(n)},datetime:function(n){var r=t.isTime(n)?e(n).attr("datetime"):e(n).attr("title");return t.parse(r)},isTime:function(t){return e(t).get(0).tagName.toLowerCase()==="time"}});var n={init:function(){var n=e.proxy(r,this);n();var i=t.settings;if(i.refreshMillis>0){setInterval(n,i.refreshMillis)}},update:function(n){e(this).data("timeago",{datetime:t.parse(n)});r.apply(this)}};e.fn.timeago=function(e,t){var r=e?n[e]:n.init;if(!r){throw new Error("Unknown function name '"+e+"' for timeago")}this.each(function(){r.call(this,t)});return this};document.createElement("abbr");document.createElement("time")});
|
151
lib/js.cookie.js
151
lib/js.cookie.js
|
@ -1,151 +0,0 @@
|
|||
/*!
|
||||
* JavaScript Cookie v2.1.2
|
||||
* https://github.com/js-cookie/js-cookie
|
||||
*
|
||||
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||||
* Released under the MIT license
|
||||
*/
|
||||
;(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
var OldCookies = window.Cookies;
|
||||
var api = window.Cookies = factory();
|
||||
api.noConflict = function () {
|
||||
window.Cookies = OldCookies;
|
||||
return api;
|
||||
};
|
||||
}
|
||||
}(function () {
|
||||
function extend () {
|
||||
var i = 0;
|
||||
var result = {};
|
||||
for (; i < arguments.length; i++) {
|
||||
var attributes = arguments[ i ];
|
||||
for (var key in attributes) {
|
||||
result[key] = attributes[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function init (converter) {
|
||||
function api (key, value, attributes) {
|
||||
var result;
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Write
|
||||
|
||||
if (arguments.length > 1) {
|
||||
attributes = extend({
|
||||
path: '/'
|
||||
}, api.defaults, attributes);
|
||||
|
||||
if (typeof attributes.expires === 'number') {
|
||||
var expires = new Date();
|
||||
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
||||
attributes.expires = expires;
|
||||
}
|
||||
|
||||
try {
|
||||
result = JSON.stringify(value);
|
||||
if (/^[\{\[]/.test(result)) {
|
||||
value = result;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (!converter.write) {
|
||||
value = encodeURIComponent(String(value))
|
||||
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||
} else {
|
||||
value = converter.write(value, key);
|
||||
}
|
||||
|
||||
key = encodeURIComponent(String(key));
|
||||
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
||||
key = key.replace(/[\(\)]/g, escape);
|
||||
|
||||
return (document.cookie = [
|
||||
key, '=', value,
|
||||
attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
|
||||
attributes.path && '; path=' + attributes.path,
|
||||
attributes.domain && '; domain=' + attributes.domain,
|
||||
attributes.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
if (!key) {
|
||||
result = {};
|
||||
}
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling "get()"
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
var rdecode = /(%[0-9A-Z]{2})+/g;
|
||||
var i = 0;
|
||||
|
||||
for (; i < cookies.length; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var cookie = parts.slice(1).join('=');
|
||||
|
||||
if (cookie.charAt(0) === '"') {
|
||||
cookie = cookie.slice(1, -1);
|
||||
}
|
||||
|
||||
try {
|
||||
var name = parts[0].replace(rdecode, decodeURIComponent);
|
||||
cookie = converter.read ?
|
||||
converter.read(cookie, name) : converter(cookie, name) ||
|
||||
cookie.replace(rdecode, decodeURIComponent);
|
||||
|
||||
if (this.json) {
|
||||
try {
|
||||
cookie = JSON.parse(cookie);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (key === name) {
|
||||
result = cookie;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
api.set = api;
|
||||
api.get = function (key) {
|
||||
return api(key);
|
||||
};
|
||||
api.getJSON = function () {
|
||||
return api.apply({
|
||||
json: true
|
||||
}, [].slice.call(arguments));
|
||||
};
|
||||
api.defaults = {};
|
||||
|
||||
api.remove = function (key, attributes) {
|
||||
api(key, '', extend(attributes, {
|
||||
expires: -1
|
||||
}));
|
||||
};
|
||||
|
||||
api.withConverter = init;
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
return init(function () {});
|
||||
}));
|
4
lib/modernizr-2.7.1.min.js
vendored
4
lib/modernizr-2.7.1.min.js
vendored
File diff suppressed because one or more lines are too long
279
lib/password.php
279
lib/password.php
|
@ -1,279 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* A Compatibility library with PHP 5.5's simplified password hashing API.
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@php.net>
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
* @copyright 2012 The Authors
|
||||
*/
|
||||
|
||||
namespace {
|
||||
|
||||
if (!defined('PASSWORD_DEFAULT')) {
|
||||
|
||||
define('PASSWORD_BCRYPT', 1);
|
||||
define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
|
||||
|
||||
/**
|
||||
* Hash the password using the specified algorithm
|
||||
*
|
||||
* @param string $password The password to hash
|
||||
* @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
|
||||
* @param array $options The options for the algorithm to use
|
||||
*
|
||||
* @return string|false The hashed password, or false on error.
|
||||
*/
|
||||
function password_hash($password, $algo, array $options = array()) {
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (!is_string($password)) {
|
||||
trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (!is_int($algo)) {
|
||||
trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
$resultLength = 0;
|
||||
switch ($algo) {
|
||||
case PASSWORD_BCRYPT:
|
||||
// Note that this is a C constant, but not exposed to PHP, so we don't define it here.
|
||||
$cost = 10;
|
||||
if (isset($options['cost'])) {
|
||||
$cost = $options['cost'];
|
||||
if ($cost < 4 || $cost > 31) {
|
||||
trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// The length of salt to generate
|
||||
$raw_salt_len = 16;
|
||||
// The length required in the final serialization
|
||||
$required_salt_len = 22;
|
||||
$hash_format = sprintf("$2y$%02d$", $cost);
|
||||
// The expected length of the final crypt() output
|
||||
$resultLength = 60;
|
||||
break;
|
||||
default:
|
||||
trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
$salt_requires_encoding = false;
|
||||
if (isset($options['salt'])) {
|
||||
switch (gettype($options['salt'])) {
|
||||
case 'NULL':
|
||||
case 'boolean':
|
||||
case 'integer':
|
||||
case 'double':
|
||||
case 'string':
|
||||
$salt = (string) $options['salt'];
|
||||
break;
|
||||
case 'object':
|
||||
if (method_exists($options['salt'], '__tostring')) {
|
||||
$salt = (string) $options['salt'];
|
||||
break;
|
||||
}
|
||||
case 'array':
|
||||
case 'resource':
|
||||
default:
|
||||
trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) {
|
||||
trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING);
|
||||
return null;
|
||||
} elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {
|
||||
$salt_requires_encoding = true;
|
||||
}
|
||||
} else {
|
||||
$buffer = '';
|
||||
$buffer_valid = false;
|
||||
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
|
||||
$buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);
|
||||
if ($buffer) {
|
||||
$buffer_valid = true;
|
||||
}
|
||||
}
|
||||
if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {
|
||||
$buffer = openssl_random_pseudo_bytes($raw_salt_len);
|
||||
if ($buffer) {
|
||||
$buffer_valid = true;
|
||||
}
|
||||
}
|
||||
if (!$buffer_valid && @is_readable('/dev/urandom')) {
|
||||
$f = fopen('/dev/urandom', 'r');
|
||||
$read = PasswordCompat\binary\_strlen($buffer);
|
||||
while ($read < $raw_salt_len) {
|
||||
$buffer .= fread($f, $raw_salt_len - $read);
|
||||
$read = PasswordCompat\binary\_strlen($buffer);
|
||||
}
|
||||
fclose($f);
|
||||
if ($read >= $raw_salt_len) {
|
||||
$buffer_valid = true;
|
||||
}
|
||||
}
|
||||
if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) {
|
||||
$bl = PasswordCompat\binary\_strlen($buffer);
|
||||
for ($i = 0; $i < $raw_salt_len; $i++) {
|
||||
if ($i < $bl) {
|
||||
$buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
|
||||
} else {
|
||||
$buffer .= chr(mt_rand(0, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
$salt = $buffer;
|
||||
$salt_requires_encoding = true;
|
||||
}
|
||||
if ($salt_requires_encoding) {
|
||||
// encode string with the Base64 variant used by crypt
|
||||
$base64_digits =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
$bcrypt64_digits =
|
||||
'./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
$base64_string = base64_encode($salt);
|
||||
$salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits);
|
||||
}
|
||||
$salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len);
|
||||
|
||||
$hash = $hash_format . $salt;
|
||||
|
||||
$ret = crypt($password, $hash);
|
||||
|
||||
if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != $resultLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about the password hash. Returns an array of the information
|
||||
* that was used to generate the password hash.
|
||||
*
|
||||
* array(
|
||||
* 'algo' => 1,
|
||||
* 'algoName' => 'bcrypt',
|
||||
* 'options' => array(
|
||||
* 'cost' => 10,
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @param string $hash The password hash to extract info from
|
||||
*
|
||||
* @return array The array of information about the hash.
|
||||
*/
|
||||
function password_get_info($hash) {
|
||||
$return = array(
|
||||
'algo' => 0,
|
||||
'algoName' => 'unknown',
|
||||
'options' => array(),
|
||||
);
|
||||
if (PasswordCompat\binary\_substr($hash, 0, 4) == '$2y$' && PasswordCompat\binary\_strlen($hash) == 60) {
|
||||
$return['algo'] = PASSWORD_BCRYPT;
|
||||
$return['algoName'] = 'bcrypt';
|
||||
list($cost) = sscanf($hash, "$2y$%d$");
|
||||
$return['options']['cost'] = $cost;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the password hash needs to be rehashed according to the options provided
|
||||
*
|
||||
* If the answer is true, after validating the password using password_verify, rehash it.
|
||||
*
|
||||
* @param string $hash The hash to test
|
||||
* @param int $algo The algorithm used for new password hashes
|
||||
* @param array $options The options array passed to password_hash
|
||||
*
|
||||
* @return boolean True if the password needs to be rehashed.
|
||||
*/
|
||||
function password_needs_rehash($hash, $algo, array $options = array()) {
|
||||
$info = password_get_info($hash);
|
||||
if ($info['algo'] != $algo) {
|
||||
return true;
|
||||
}
|
||||
switch ($algo) {
|
||||
case PASSWORD_BCRYPT:
|
||||
$cost = isset($options['cost']) ? $options['cost'] : 10;
|
||||
if ($cost != $info['options']['cost']) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify a password against a hash using a timing attack resistant approach
|
||||
*
|
||||
* @param string $password The password to verify
|
||||
* @param string $hash The hash to verify against
|
||||
*
|
||||
* @return boolean If the password matches the hash
|
||||
*/
|
||||
function password_verify($password, $hash) {
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
$ret = crypt($password, $hash);
|
||||
if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != PasswordCompat\binary\_strlen($hash) || PasswordCompat\binary\_strlen($ret) <= 13) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = 0;
|
||||
for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) {
|
||||
$status |= (ord($ret[$i]) ^ ord($hash[$i]));
|
||||
}
|
||||
|
||||
return $status === 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace PasswordCompat\binary {
|
||||
/**
|
||||
* Count the number of bytes in a string
|
||||
*
|
||||
* We cannot simply use strlen() for this, because it might be overwritten by the mbstring extension.
|
||||
* In this case, strlen() will count the number of *characters* based on the internal encoding. A
|
||||
* sequence of bytes might be regarded as a single multibyte character.
|
||||
*
|
||||
* @param string $binary_string The input string
|
||||
*
|
||||
* @internal
|
||||
* @return int The number of bytes
|
||||
*/
|
||||
function _strlen($binary_string) {
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($binary_string, '8bit');
|
||||
}
|
||||
return strlen($binary_string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a substring based on byte limits
|
||||
*
|
||||
* @see _strlen()
|
||||
*
|
||||
* @param string $binary_string The input string
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
*
|
||||
* @internal
|
||||
* @return string The substring
|
||||
*/
|
||||
function _substr($binary_string, $start, $length) {
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($binary_string, $start, $length, '8bit');
|
||||
}
|
||||
return substr($binary_string, $start, $length);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,277 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
* - Documentation and latest version
|
||||
* http://recaptcha.net/plugins/php/
|
||||
* - Get a reCAPTCHA API Key
|
||||
* https://www.google.com/recaptcha/admin/create
|
||||
* - Discussion group
|
||||
* http://groups.google.com/group/recaptcha
|
||||
*
|
||||
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
||||
* AUTHORS:
|
||||
* Mike Crawford
|
||||
* Ben Maurer
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The reCAPTCHA server URL's
|
||||
*/
|
||||
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
||||
|
||||
/**
|
||||
* Encodes the given data into a query string format
|
||||
* @param $data - array of string elements to be encoded
|
||||
* @return string - encoded request
|
||||
*/
|
||||
function _recaptcha_qsencode ($data) {
|
||||
$req = "";
|
||||
foreach ( $data as $key => $value )
|
||||
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
|
||||
|
||||
// Cut the last '&'
|
||||
$req=substr($req,0,strlen($req)-1);
|
||||
return $req;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Submits an HTTP POST to a reCAPTCHA server
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $data
|
||||
* @param int port
|
||||
* @return array response
|
||||
*/
|
||||
function _recaptcha_http_post($host, $path, $data, $port = 80) {
|
||||
|
||||
$req = _recaptcha_qsencode ($data);
|
||||
|
||||
$http_request = "POST $path HTTP/1.0\r\n";
|
||||
$http_request .= "Host: $host\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
|
||||
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $req;
|
||||
|
||||
$response = '';
|
||||
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
|
||||
die ('Could not open socket');
|
||||
}
|
||||
|
||||
fwrite($fs, $http_request);
|
||||
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the challenge HTML (javascript and non-javascript version).
|
||||
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
||||
* is embedded within the HTML form it was called from.
|
||||
* @param string $pubkey A public key for reCAPTCHA
|
||||
* @param string $error The error given by reCAPTCHA (optional, default is null)
|
||||
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
|
||||
|
||||
* @return string - The HTML to be embedded in the user's form.
|
||||
*/
|
||||
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
||||
{
|
||||
if ($pubkey == null || $pubkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($use_ssl) {
|
||||
$server = RECAPTCHA_API_SECURE_SERVER;
|
||||
} else {
|
||||
$server = RECAPTCHA_API_SERVER;
|
||||
}
|
||||
|
||||
$errorpart = "";
|
||||
if ($error) {
|
||||
$errorpart = "&error=" . $error;
|
||||
}
|
||||
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
|
||||
|
||||
<noscript>
|
||||
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
|
||||
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
||||
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
||||
</noscript>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
||||
*/
|
||||
class ReCaptchaResponse {
|
||||
var $is_valid;
|
||||
var $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calls an HTTP POST function to verify if the user's guess was correct
|
||||
* @param string $privkey
|
||||
* @param string $remoteip
|
||||
* @param string $challenge
|
||||
* @param string $response
|
||||
* @param array $extra_params an array of extra variables to post to the server
|
||||
* @return ReCaptchaResponse
|
||||
*/
|
||||
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
|
||||
{
|
||||
if ($privkey == null || $privkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($remoteip == null || $remoteip == '') {
|
||||
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//discard spam submissions
|
||||
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
||||
$recaptcha_response = new ReCaptchaResponse();
|
||||
$recaptcha_response->is_valid = false;
|
||||
$recaptcha_response->error = 'incorrect-captcha-sol';
|
||||
return $recaptcha_response;
|
||||
}
|
||||
|
||||
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
|
||||
array (
|
||||
'privatekey' => $privkey,
|
||||
'remoteip' => $remoteip,
|
||||
'challenge' => $challenge,
|
||||
'response' => $response
|
||||
) + $extra_params
|
||||
);
|
||||
|
||||
$answers = explode ("\n", $response [1]);
|
||||
$recaptcha_response = new ReCaptchaResponse();
|
||||
|
||||
if (trim ($answers [0]) == 'true') {
|
||||
$recaptcha_response->is_valid = true;
|
||||
}
|
||||
else {
|
||||
$recaptcha_response->is_valid = false;
|
||||
$recaptcha_response->error = $answers [1];
|
||||
}
|
||||
return $recaptcha_response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a URL where the user can sign up for reCAPTCHA. If your application
|
||||
* has a configuration page where you enter a key, you should provide a link
|
||||
* using this function.
|
||||
* @param string $domain The domain where the page is hosted
|
||||
* @param string $appname The name of your application
|
||||
*/
|
||||
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
||||
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
|
||||
}
|
||||
|
||||
function _recaptcha_aes_pad($val) {
|
||||
$block_size = 16;
|
||||
$numpad = $block_size - (strlen ($val) % $block_size);
|
||||
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
|
||||
}
|
||||
|
||||
/* Mailhide related code */
|
||||
|
||||
function _recaptcha_aes_encrypt($val,$ky) {
|
||||
if (! function_exists ("mcrypt_encrypt")) {
|
||||
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
||||
}
|
||||
$mode=MCRYPT_MODE_CBC;
|
||||
$enc=MCRYPT_RIJNDAEL_128;
|
||||
$val=_recaptcha_aes_pad($val);
|
||||
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
||||
}
|
||||
|
||||
|
||||
function _recaptcha_mailhide_urlbase64 ($x) {
|
||||
return strtr(base64_encode ($x), '+/', '-_');
|
||||
}
|
||||
|
||||
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
||||
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
||||
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
||||
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
|
||||
}
|
||||
|
||||
|
||||
$ky = pack('H*', $privkey);
|
||||
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
||||
|
||||
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the parts of the email to expose to the user.
|
||||
* eg, given johndoe@example,com return ["john", "example.com"].
|
||||
* the email is then displayed as john...@example.com
|
||||
*/
|
||||
function _recaptcha_mailhide_email_parts ($email) {
|
||||
$arr = preg_split("/@/", $email );
|
||||
|
||||
if (strlen ($arr[0]) <= 4) {
|
||||
$arr[0] = substr ($arr[0], 0, 1);
|
||||
} else if (strlen ($arr[0]) <= 6) {
|
||||
$arr[0] = substr ($arr[0], 0, 3);
|
||||
} else {
|
||||
$arr[0] = substr ($arr[0], 0, 4);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets html to display an email address given a public an private key.
|
||||
* to get a key, go to:
|
||||
*
|
||||
* http://www.google.com/recaptcha/mailhide/apikey
|
||||
*/
|
||||
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
||||
$emailparts = _recaptcha_mailhide_email_parts ($email);
|
||||
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
|
||||
|
||||
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
|
||||
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,458 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
|
@ -1,57 +0,0 @@
|
|||
NAME:
|
||||
|
||||
Securimage - A PHP class for creating and managing form CAPTCHA images
|
||||
|
||||
VERSION: 1.0.2
|
||||
|
||||
AUTHOR:
|
||||
|
||||
Drew Phillips <drew@drew-phillips.com>
|
||||
|
||||
DOWNLOAD:
|
||||
|
||||
The latest version can always be
|
||||
found at http://www.phpcaptcha.org
|
||||
|
||||
DOCUMENTATION:
|
||||
|
||||
Online documentation of the class, methods, and variables can
|
||||
be found at http://www.phpcaptcha.org/Securimage_Docs/
|
||||
|
||||
REQUIREMENTS:
|
||||
PHP 4.3.0
|
||||
GD 2.0
|
||||
FreeType (optional, required for TTF support)
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
require_once 'securimage.php';
|
||||
|
||||
$image = new Securimage();
|
||||
|
||||
$image->show();
|
||||
|
||||
// Code Validation
|
||||
|
||||
$image = new Securimage();
|
||||
if ($image->check($_POST['code']) == true) {
|
||||
echo "Correct!";
|
||||
} else {
|
||||
echo "Sorry, wrong code.";
|
||||
}
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
What is Securimage?
|
||||
|
||||
Securimage is a PHP class that is used to generate and validate CAPTCHA images.
|
||||
The classes uses an existing PHP session or creates its own if none is found to store the
|
||||
CAPTCHA code. Variables within the class are used to control the style and display of the image.
|
||||
The class supports TTF fonts and effects for strengthening the security of the image.
|
||||
If TTF support is not available, GD fonts can be used as well, but certain options such as
|
||||
transparent text and angled letters cannot be used.
|
||||
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) 2007 Drew Phillips. All rights reserved.
|
||||
This software is released under the GNU Lesser General Public License.
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue