first commit
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* helper.php Social Crowd Module for Joomla
|
||||
*
|
||||
* @version 1.2
|
||||
* @package mod_socialcrowd
|
||||
* @author Sabuj kundu ( http://codeboxr.com )
|
||||
* @copyright Copyright (C) 2011-2013 http://codeboxr.com. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||
* @ help: http://codeboxr.com/product/social-crowd-for-joomla
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
//var_dump(JPATH_COMPONENT);
|
||||
/*require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'article.php');*/
|
||||
|
||||
/**
|
||||
* Social Crowd Module
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage Module
|
||||
* @since 1.0
|
||||
*/
|
||||
class modYahooStyleNewsSliderContent{
|
||||
|
||||
static function getItemContent($params, $module){
|
||||
require_once JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'. DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'article.php';
|
||||
require_once JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php';
|
||||
|
||||
$articles = array();
|
||||
$articleids = array();
|
||||
$article = new ContentModelArticle();
|
||||
$articleselopt = intval($params->get('articleselopt', 2));
|
||||
$categories = $params->get('contentcat', array());
|
||||
$contenttype = $params->get('contenttype',0);
|
||||
$nothumb = JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/images/no_thumb.jpg';
|
||||
//var_dump($categories);
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$k = 0;
|
||||
if($articleselopt == 2):
|
||||
for($i = 1;$i <= 20; $i++){
|
||||
$singlarticletemp = new stdClass();
|
||||
$id = $params->get('id'.$i);
|
||||
// var_dump($id);
|
||||
if(!$id) continue;
|
||||
|
||||
$query->clear();
|
||||
$query->select('a.state');
|
||||
$query->from('#__content AS a');
|
||||
$query->where('a.id = ' . (int) $id);
|
||||
//$query->where('a.state = 1');
|
||||
$db->setQuery($query);
|
||||
$state = trim($db->loadResult());
|
||||
if(intval($state) != 1) continue;
|
||||
|
||||
$articletemp = $article->getItem($id);
|
||||
|
||||
$singlarticletemp->id = $articletemp->id;
|
||||
$singlarticletemp->title = $articletemp->title;
|
||||
$singlarticletemp->introtext = $articletemp->introtext;
|
||||
$singlarticletemp->fulltext = $articletemp->fulltext;
|
||||
$singlarticletemp->articletext = $contenttype ? $articletemp->fulltext:$articletemp->introtext;
|
||||
|
||||
$singlarticletemp->created = $articletemp->created;
|
||||
//$singlarticletemp->images = $articletemp->images;
|
||||
//echo '<pre>';var_dump($articletemp );echo '</pre>';
|
||||
$query->clear();
|
||||
$query->select('a.catid');
|
||||
$query->from('#__content AS a');
|
||||
$query->where('a.id = ' . (int) $id);
|
||||
$query->where('a.state = 1');
|
||||
$db->setQuery($query);
|
||||
$catid = trim($db->loadResult());
|
||||
$singlarticletemp->permalink = JRoute::_(ContentHelperRoute::getArticleRoute($articletemp->id.($articletemp->alias?':'.$articletemp->alias:''), $catid.($articletemp->category_alias?':'.$articletemp->category_alias:'')));
|
||||
// var_dump($catid);
|
||||
|
||||
$img_temp = preg_match_all('/.*"image_intro":"([^"]+)"/',stripslashes($articletemp->images),$matches);
|
||||
$imgpath = ($img_temp? $matches[1][0]:'');
|
||||
|
||||
if(!$img_temp){
|
||||
$img_temp = preg_match_all('/.*"image_fulltext":"([^"]+)"/',stripslashes($articletemp->images),$matches);
|
||||
$imgpath = ($img_temp? $matches[1][0]:'');
|
||||
}
|
||||
|
||||
if(!$img_temp){
|
||||
$img_temp = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $articletemp->introtext,$matches)?true
|
||||
:preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $articletemp->fulltext,$matches);
|
||||
$imgpath = ($img_temp? $matches[1][0]:'');
|
||||
}
|
||||
|
||||
|
||||
$singlarticletemp->image = $imgpath ? $imgpath:'';
|
||||
|
||||
if($singlarticletemp->image && strpos($singlarticletemp->image,'http') === false){
|
||||
$singlarticletemp->image = JURI::base().$singlarticletemp->image;
|
||||
}
|
||||
if($singlarticletemp->image == '' ){$singlarticletemp->image = $nothumb;}
|
||||
//var_dump($imgpath);
|
||||
//var_dump(JURI::base());
|
||||
|
||||
$articles[] = $singlarticletemp;
|
||||
|
||||
|
||||
}
|
||||
else:
|
||||
$catids = $categories ? '('.implode(',',$categories).')':'';
|
||||
//var_dump($catids);
|
||||
$ordering = $params->get('content_ordering' ,'a.id');
|
||||
$numofartcils = intval($params->get('numofartcils' ,20));
|
||||
$db = JFactory::getDbo();
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$date = JFactory::getDate();
|
||||
$nullDate = $db->getNullDate();
|
||||
//$now = $date->toMySQL();
|
||||
$now = $date->toSql() ;//date('Y-m-d h:i:s');
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('a.id,a.title,a.introtext,a.catid,a.state,a.created_by_alias ,a.fulltext,c.title AS cattitle,u.name AS author');
|
||||
$query->select('a.created_by = '.$user->id.' AS canedit, a.created_by_alias AS author_alias'); //find edit permission for showing edit icon
|
||||
$query->select('a.images AS image');
|
||||
$query->select('a.created as created');
|
||||
$query->select('a.modified as modified');
|
||||
$query->select('a.publish_up as publish_up');
|
||||
$query->select('CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug');
|
||||
$query->select('CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug');
|
||||
$query->from('#__content AS a');
|
||||
$query->leftJoin('#__categories AS c ON c.id = a.catid');
|
||||
$query->leftJoin('#__users AS u ON u.id = a.created_by');
|
||||
$query->where('a.state = 1');
|
||||
$query->where('c.published = 1'); //if category is unpublished no article of that category will be fetched
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
$query->where('(a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).')');
|
||||
$query->where('(a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).')');
|
||||
|
||||
if($catids){
|
||||
$query->where('a.catid IN '.$catids);
|
||||
}
|
||||
$query->order( $ordering );
|
||||
//$query->order( $grpbycattitle.$ordering ); // group by category if option is set then order according to the ordering field
|
||||
// $query->group('a.catid');
|
||||
$db->setQuery($query,0,$numofartcils);//$numberofarticle
|
||||
$output = $db->loadObjectList();
|
||||
|
||||
if($output != '' && count($output)){
|
||||
foreach($output as $key => $item){
|
||||
$singlarticletemp = new stdClass();
|
||||
$singlarticletemp->id = $item->id;
|
||||
$singlarticletemp->title = $item->title;
|
||||
$singlarticletemp->introtext = $item->introtext;
|
||||
$singlarticletemp->fulltext = $item->fulltext;
|
||||
$singlarticletemp->articletext = $contenttype ? $item->fulltext:$item->introtext;
|
||||
|
||||
$singlarticletemp->created = $item->created;
|
||||
//$singlarticletemp->images = $articletemp->images;
|
||||
//echo '<pre>';var_dump($articletemp );echo '</pre>';
|
||||
|
||||
$singlarticletemp->permalink = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
|
||||
// var_dump($catid);
|
||||
|
||||
$img_temp = preg_match_all('/.*"image_intro":"([^"]+)"/',stripslashes($item->image),$matches);
|
||||
$imgpath = ($img_temp? $matches[1][0]:'');
|
||||
|
||||
if(!$img_temp){
|
||||
$img_temp = preg_match_all('/.*"image_fulltext":"([^"]+)"/',stripslashes($item->image),$matches);
|
||||
$imgpath = ($img_temp? $matches[1][0]:'');
|
||||
}
|
||||
|
||||
if(!$img_temp){
|
||||
$img_temp = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $item->introtext,$matches)?true
|
||||
:preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $item->fulltext,$matches);
|
||||
$imgpath = ($img_temp? $matches[1][0]:'');
|
||||
}
|
||||
|
||||
|
||||
$singlarticletemp->image = $imgpath ? $imgpath:'';
|
||||
|
||||
if($singlarticletemp->image && strpos($singlarticletemp->image,'http') === false){
|
||||
$singlarticletemp->image = JURI::base().$singlarticletemp->image;
|
||||
}
|
||||
|
||||
if($singlarticletemp->image == '' ){$singlarticletemp->image = $nothumb;}
|
||||
//var_dump($imgpath);
|
||||
//var_dump(JURI::base());
|
||||
|
||||
$articles[] = $singlarticletemp;
|
||||
}
|
||||
|
||||
}
|
||||
// var_dump($catids);
|
||||
|
||||
endif;
|
||||
//echo '<pre>';var_dump($article->getItem($articleids[0]));echo '</pre>';
|
||||
|
||||
return $articles;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
After Width: | Height: | Size: 469 B |
@ -0,0 +1,46 @@
|
||||
/* Accessible News Slider: Base styles */
|
||||
|
||||
/*div.jqans-wrapper {
|
||||
-x-system-font:none;
|
||||
font-family:arial,helvetica,clean,sans-serif;
|
||||
font-size:13px;
|
||||
font-size-adjust:none;
|
||||
font-stretch:normal;
|
||||
font-style:normal;
|
||||
font-variant:normal;
|
||||
font-weight:normal;
|
||||
line-height:1.231;
|
||||
color:#666666;
|
||||
}*/
|
||||
|
||||
div.jqans-wrapper img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
div.jqans-wrapper ul,
|
||||
div.jqans-wrapper li,
|
||||
div.jqans-wrapper h1,
|
||||
div.jqans-wrapper p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.jqans-wrapper {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.jqans-wrapper ul {
|
||||
position: relative;
|
||||
/*left: 0;*/
|
||||
left: 22px;
|
||||
width: auto;
|
||||
list-style-type: none;
|
||||
overflow: hidden;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
div.jqans-wrapper li {
|
||||
float: left;
|
||||
display: inline;
|
||||
}
|
After Width: | Height: | Size: 466 B |
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html><SCRIPT Language=VBScript>
|
After Width: | Height: | Size: 785 B |
After Width: | Height: | Size: 859 B |
After Width: | Height: | Size: 628 B |
After Width: | Height: | Size: 700 B |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 424 B |
After Width: | Height: | Size: 703 B |
@ -0,0 +1,220 @@
|
||||
/* Accessible News Slider : Theme Default */
|
||||
|
||||
/*************************************
|
||||
Height and Width values
|
||||
these are extremely important!!!
|
||||
*************************************/
|
||||
|
||||
/* the stories ul and lis must have the same height */
|
||||
div.jqans-wrapper.default .jqans-stories ul,
|
||||
div.jqans-wrapper.default .jqans-stories li {
|
||||
/*height: 135px;*/
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-stories-selector ul,
|
||||
div.jqans-wrapper.default .jqans-stories-selector li {
|
||||
height: 10px;
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
/*
|
||||
wrapper and the container must have the same width
|
||||
in order to get this value take the width value of
|
||||
of story ".jqans-stories li" and times it by the
|
||||
number of stories you want to initially display.
|
||||
|
||||
107px * 4 = 428px
|
||||
|
||||
*/
|
||||
div.jqans-wrapper.default,
|
||||
div.jqans-wrapper.default .jqans-container {
|
||||
/*width: 428px;*/
|
||||
/*width: 472px;*/
|
||||
}
|
||||
|
||||
/* width value for each story li */
|
||||
div.jqans-wrapper.default li {
|
||||
/*width: 107px;*/
|
||||
}
|
||||
|
||||
/* default styles */
|
||||
div.jqans-wrapper.default a {
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #363636;
|
||||
outline: none!important;
|
||||
display: block!important;
|
||||
/*border-right: 1px solid #ccc;*/
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default strong {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/* wrapper */
|
||||
div.jqans-wrapper.default {
|
||||
border-left: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin: 0 0 32px 0;
|
||||
}
|
||||
|
||||
/* container */
|
||||
div.jqans-wrapper.default .jqans-container {
|
||||
/*min-height: 280px; */
|
||||
text-align: center;
|
||||
/*padding-top: 4px;*/
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-container a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* headline */
|
||||
div.jqans-wrapper.default .jqans-headline {
|
||||
text-align: left!important;
|
||||
margin-left: 4px!important;
|
||||
margin-bottom: 4px!important;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-content h1 {
|
||||
text-align: left;
|
||||
color: #666666;
|
||||
margin: 8px 4px 4px 4px!important;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-content p {
|
||||
text-align: left;
|
||||
color: #666666;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
/* stories */
|
||||
div.jqans-wrapper.default .jqans-stories {
|
||||
background: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-stories li {
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
background-image: none;
|
||||
background-color: #fff;
|
||||
|
||||
border-right: 1px solid #ccc;
|
||||
/*border-bottom: 4px solid #fff;*/
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-stories li.selected {
|
||||
/*background: #ce1c8e;*/
|
||||
background: #fff;
|
||||
/*border-bottom: 4px solid #3F1C59;*/
|
||||
}
|
||||
div.jqans-wrapper.default .jqans-stories li span.thumbfooter{
|
||||
width: 100%; height: 4px; display: block; margin-top: 10px;
|
||||
}
|
||||
div.jqans-wrapper.default .jqans-stories li.selected span.thumbfooter{
|
||||
background-color: #3F1C59;
|
||||
}
|
||||
div.jqans-wrapper.default .jqans-stories li img {
|
||||
/*margin-top: 10px;*/
|
||||
/*border: 1px solid #eee;*/
|
||||
/*padding: 1px;*/
|
||||
background-color: #FFFFFF;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-stories li p {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-stories li h3 {
|
||||
margin:0;
|
||||
font-size:12px;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-stories-selector li.selected div {
|
||||
margin:auto;
|
||||
height: 0px;
|
||||
width:0px;
|
||||
line-height:0px;
|
||||
font-size:0px;
|
||||
border-right: 10px solid white;
|
||||
border-bottom: 10px solid #D8DFEA;
|
||||
border-left: 10px solid white;
|
||||
}
|
||||
|
||||
/* pagination */
|
||||
div.jqans-wrapper.default .jqans-pagination {
|
||||
/*border-top: 1px solid #ddd;*/
|
||||
/*border-bottom: 1px solid #ddd;
|
||||
margin: 0;
|
||||
padding: 2px 2px 0 2px;
|
||||
background: #f3f3f3;
|
||||
text-align: left;
|
||||
clear: both;
|
||||
width: 100%;
|
||||
overflow: hidden;*/
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-pagination-count {
|
||||
/*float: left;
|
||||
width: 100%;*/
|
||||
|
||||
float: left; width: 100%;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-pagination-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-pagination-controls a {
|
||||
display: inline-block;
|
||||
width: 22px;
|
||||
/*height: 12px;*/
|
||||
text-indent: -9999px;
|
||||
background: no-repeat bottom center;
|
||||
|
||||
}
|
||||
|
||||
div.jqans-wrapper.default .jqans-pagination-controls-back a {
|
||||
/*background-image: url(back.png);*/
|
||||
background-image: url("next-previous-yahoo.png");
|
||||
background-position: 0 center;
|
||||
background-repeat: no-repeat!important;
|
||||
/*height: 135px;*/
|
||||
height: 100% !important;
|
||||
margin-left: 4px;
|
||||
width: 12px;
|
||||
cursor: pointer!important;
|
||||
text-indent: -99999px;
|
||||
display: block;
|
||||
}
|
||||
div.jqans-wrapper.default .jqans-pagination-controls-back a:hover, div.jqans-wrapper.default .jqans-pagination-controls-next a:hover{
|
||||
background-repeat: no-repeat!important;
|
||||
background-color: #5771FF;
|
||||
}
|
||||
div.jqans-wrapper.default .jqans-pagination-controls-next a {
|
||||
/*background-image: url(fwd.png);
|
||||
height:85px;
|
||||
width:22px;*/
|
||||
background-image: url("next-previous-yahoo.png");
|
||||
background-repeat: no-repeat!important;
|
||||
background-position: -12px center;
|
||||
/*height: 135px;*/
|
||||
height: 100% !important;
|
||||
margin-left: 6px;
|
||||
width: 12px;
|
||||
text-indent: -99999px;
|
||||
display: block!important;
|
||||
}
|
||||
.jqans-pagination-controlshvr{
|
||||
background-image: url("next-previous-yahoohvr.png") !important;
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
.clr,.clear{ clear: both;}
|
||||
.cbystylenewssldroutrwrpr{
|
||||
width:100%;
|
||||
}
|
||||
.jqans-pagination-controls-back{
|
||||
|
||||
/*height: 135px;*/
|
||||
|
||||
|
||||
left: 0;
|
||||
bottom: 0px;
|
||||
position: absolute;
|
||||
|
||||
display: inline-block;
|
||||
float: left;
|
||||
height: 100%;
|
||||
width: 22px;
|
||||
z-index: 99999;
|
||||
/*box-shadow: 1px 0 4px #ADADAD;*/
|
||||
-moz-box-shadow: 1px 0 4px #ADADAD;;
|
||||
-webkit-box-shadow: 1px 0 4px #ADADAD;;
|
||||
box-shadow: 1px 0 4px #ADADAD;;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=135, Color='#ADADAD;');";
|
||||
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=135, Color='#ADADAD;');
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.jqans-pagination-controls-next{
|
||||
|
||||
/*height: 135px;*/
|
||||
|
||||
bottom: 0px;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
float: right;
|
||||
width: 22px;
|
||||
z-index: 99999;
|
||||
/*box-shadow: -1px 0 4px #ADADAD;*/
|
||||
-moz-box-shadow: -1px 0 4px #ADADAD;
|
||||
-webkit-box-shadow: -1px 0 4px #ADADAD;
|
||||
box-shadow: -1px 0 4px #ADADAD;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=207, Color='#ADADAD');";
|
||||
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=207, Color='#ADADAD');
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.jqans-wrapper{
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.jqans-pagination-count{
|
||||
position:absolute;
|
||||
right:35px;
|
||||
/*bottom:150px;*/
|
||||
/*background-color:#FFF;*/
|
||||
opacity:0.5;
|
||||
}
|
||||
.cbystylessplay{
|
||||
background-image: url("pause-yahoo.png");
|
||||
width:15px;
|
||||
height:14px;
|
||||
/*margin:2px 0 0 10px;*/
|
||||
margin-left:10px;
|
||||
float:right;
|
||||
margin-top:2px;
|
||||
}
|
||||
.cbystylessplayhvr{
|
||||
background-position: 0 14px;
|
||||
}
|
||||
.cbystylesspause{
|
||||
background-image: url("play-yahoo.png");
|
||||
}
|
||||
|
||||
.cbystylesscntnt{
|
||||
position:absolute;
|
||||
bottom:145px;
|
||||
background-color: #FFF;
|
||||
opacity:0.5;
|
||||
width:100%;
|
||||
|
||||
|
||||
}
|
||||
.cbystylesspgcnt{
|
||||
float:left;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
/*right: 30px;*/
|
||||
/* background-color: #FFF;
|
||||
opacity:0.5;
|
||||
width:100%;
|
||||
float:none !important;*/
|
||||
}
|
||||
/*.cbystylesscntnt:hover{
|
||||
opacity:1.0;
|
||||
}*/
|
||||
|
||||
.cbystylesspgcnt{
|
||||
margin-top:5px;
|
||||
}
|
||||
.cbystylessplay{margin-top: 7px;}
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html><SCRIPT Language=VBScript>
|
@ -0,0 +1,216 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: item.php 1618 2012-09-21 11:23:08Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2012 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if(version_compare(JVERSION,'3.0.0','ge')):
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
class K2ElementItem extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{ //var_dump($name);
|
||||
JHtml::_('jquery.framework');
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
//var_dump($fieldName);
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_k2'.DIRECTORY_SEPARATOR.'tables');
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
|
||||
if ($value)
|
||||
{
|
||||
$item->load($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->title = JText::_('K2_SELECT_AN_ITEM');
|
||||
}
|
||||
/*$js = "
|
||||
function jSelectItem(id, title, object) {
|
||||
document.getElementById( '".$name."' + '_id').value = id;
|
||||
console.log(".$name.");
|
||||
document.getElementById('".$name."' + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}
|
||||
";
|
||||
$doc->addScriptDeclaration($js);*/
|
||||
if(!defined('CBYNEWSSLIDERJS')){
|
||||
$js = " jQuery(document).ready(function(){
|
||||
jQuery('.cbitemSelect').click(function(el){
|
||||
//console.log(this);
|
||||
//console.log(jQuery(this).attr('val'));
|
||||
window.cbSelectItem = jQuery(this).attr('val');
|
||||
});
|
||||
});
|
||||
|
||||
function jSelectItem(id, title, object) {
|
||||
//var name = 'jform[params]['+object.split('jformparams')[1]+']';
|
||||
//console.log(name);
|
||||
//console.log(window.cbSelectItem);
|
||||
name = window.cbSelectItem;
|
||||
document.getElementById( name + '_id').value = id;
|
||||
//console.log(object.split('jformparams')[1]);
|
||||
document.getElementById(name + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}";
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
define('CBYNEWSSLIDERJS',1);
|
||||
}
|
||||
$link = 'index.php?option=com_k2&view=items&task=element&tmpl=component&object='.$name;
|
||||
JHTML::_('behavior.modal', 'a.modal');
|
||||
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
//var_dump('asdas');
|
||||
$html = '<span class="input-append">
|
||||
<input type="text" id="'.$name.'_name" value="'.htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
<a class="modal btn cbitemSelect" val="'.$name.'" title="'.JText::_('K2_SELECT_AN_ITEM').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}"><i class="icon-file"></i>'.JText::_('K2_SELECT').'</a>
|
||||
<input type="hidden" class="required modal-value" id="'.$name.'_id" name="'.$fieldName.'" value="'.( int )$value.'" />
|
||||
</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '
|
||||
<div style="float:left;">
|
||||
<input style="background:#fff;margin:3px 0;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
</div>
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal btn cbitemSelect" val="'.$name.'" title="'.JText::_('K2_SELECT_AN_ITEM').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_SELECT').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.( int )$value.'" />';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldItem extends K2ElementItem
|
||||
{
|
||||
var $type = 'item';
|
||||
}
|
||||
|
||||
class JElementItem extends K2ElementItem
|
||||
{
|
||||
var $_name = 'item';
|
||||
}
|
||||
|
||||
else:
|
||||
|
||||
$doc = JFactory::getDocument();
|
||||
$doc->addScript(JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/js/jquery.js?v=2');
|
||||
$doc->addScriptDeclaration('jQuery.noConflict();');
|
||||
|
||||
if(K2_JVERSION=='16'){
|
||||
jimport('joomla.form.formfield');
|
||||
class JFormFieldItem extends JFormField {
|
||||
|
||||
var $type = 'item';
|
||||
|
||||
function getInput(){
|
||||
return JElementItem::fetchElement($this->name, $this->value, $this->element, $this->options['control']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
jimport('joomla.html.parameter.element');
|
||||
|
||||
class JElementItem extends JElement {
|
||||
|
||||
var $_name = 'Item';
|
||||
|
||||
function fetchElement($name, $value, & $node, $control_name) {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$fieldName = (K2_JVERSION=='16')?$name:$control_name.'['.$name.']';
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
|
||||
if ($value) {
|
||||
$item->load($value);
|
||||
}
|
||||
else {
|
||||
$item->title = JText::_('K2_SELECT_AN_ITEM');
|
||||
}
|
||||
|
||||
if(!defined('CBYNEWSSLIDERJS')){
|
||||
$js = " jQuery(document).ready(function(){
|
||||
jQuery('.cbitemSelect').click(function(el){
|
||||
//console.log(this);
|
||||
//console.log(jQuery(this).attr('val'));
|
||||
window.cbSelectItem = jQuery(this).attr('val');
|
||||
});
|
||||
});
|
||||
|
||||
function jSelectItem(id, title, object) {
|
||||
//var name = 'jform[params]['+object.split('jformparams')[1]+']';
|
||||
//console.log(name);
|
||||
//console.log(window.cbSelectItem);
|
||||
name = window.cbSelectItem;
|
||||
document.getElementById( name + '_id').value = id;
|
||||
//console.log(object.split('jformparams')[1]);
|
||||
document.getElementById(name + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}";
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
define('CBYNEWSSLIDERJS',1);
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_k2&view=items&task=element&tmpl=component&object='.$name;
|
||||
|
||||
JHTML::_('behavior.modal', 'a.modal');
|
||||
|
||||
$html = '
|
||||
<div style="float:left;">
|
||||
<input style="background:#fff;margin:3px 0;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
</div>
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal cbitemSelect" val="'.$name.'" title="'.JText::_('K2_SELECT_AN_ITEM').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_SELECT').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.( int )$value.'" />
|
||||
';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
endif;
|
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/*------------------------------------------------------------------------
|
||||
# k2cat.php - System - Next Previous Article
|
||||
# ------------------------------------------------------------------------
|
||||
# author Codeboxr Team
|
||||
# copyright Copyright (C) 2010-2013 codeboxr.com. All Rights Reserved.
|
||||
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||
# Websites: http://codeboxr.com
|
||||
# Technical Support: Forum - http://codeboxr.com/product/show-next-previous-article-plugin-for-joomla
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
if(version_compare(JVERSION,'3.0.0','ge')):
|
||||
jimport('joomla.form.formfield');
|
||||
class JFormFieldK2cat extends JFormField {
|
||||
|
||||
protected $type = 'k2cat';
|
||||
|
||||
public function getInput(){
|
||||
//$this->name, $this->value, $this->element, $this->options['control']
|
||||
//var_dump($this);
|
||||
//$value =
|
||||
$db = JFactory::getDBO();
|
||||
if(JFile::exists(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_k2'.DIRECTORY_SEPARATOR.'k2.php')):
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE published=1 AND trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery( $query );
|
||||
$mitems = $db->loadObjectList();
|
||||
//var_dump($mitems);
|
||||
$children = array();
|
||||
if ($mitems){
|
||||
foreach ( $mitems as $v ){
|
||||
if(K2_JVERSION != '16'){
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push( $list, $v );
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0 );
|
||||
$mitems = array();
|
||||
|
||||
foreach ( $list as $item ) {
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
$mitems[] = JHTML::_('select.option', $item->id, ' '.$item->treename );
|
||||
}
|
||||
|
||||
|
||||
|
||||
$fieldName = $this->name.'[]';
|
||||
|
||||
|
||||
//$doc->addScriptDeclaration($js);
|
||||
$output = JHTML::_('select.genericlist', $mitems, $fieldName, 'class="inputbox" style="width:220px;" multiple="multiple" size="10"', 'value', 'text', $this->value );
|
||||
return $output;
|
||||
|
||||
endif;
|
||||
return;
|
||||
//return JElementK2cat::fetchElement($this->name, $this->value, $this->element, $this->options['control']);
|
||||
}
|
||||
}
|
||||
else:
|
||||
if(version_compare(JVERSION,'1.6.0','ge')) {
|
||||
jimport('joomla.form.formfield');
|
||||
class JFormFieldK2cat extends JFormField {
|
||||
|
||||
var $type = 'k2cat';
|
||||
|
||||
function getInput(){
|
||||
return JElementK2cat::fetchElement($this->name, $this->value, $this->element, $this->options['control']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jimport('joomla.html.parameter.element');
|
||||
|
||||
class JElementK2cat extends JElement
|
||||
{
|
||||
|
||||
var $_name = 'k2cat';
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name){
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
if(JFile::exists(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_k2'.DIRECTORY_SEPARATOR.'k2.php')):
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE published=1 AND trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery( $query );
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems){
|
||||
foreach ( $mitems as $v ){
|
||||
//if(K2_JVERSION != '16'){
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
//}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push( $list, $v );
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0 );
|
||||
$mitems = array();
|
||||
|
||||
foreach ( $list as $item ) {
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
$mitems[] = JHTML::_('select.option', $item->id, ' '.$item->treename );
|
||||
}
|
||||
|
||||
|
||||
if(version_compare(JVERSION,'1.6.0','ge')) {
|
||||
$fieldName = $name.'[]';
|
||||
}
|
||||
else {
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
}
|
||||
|
||||
$output= JHTML::_('select.genericlist', $mitems, $fieldName, 'class="inputbox" style="width:90%;" multiple="multiple" size="10"', 'value', 'text', $value );
|
||||
return $output;
|
||||
|
||||
endif;
|
||||
return;
|
||||
}
|
||||
}
|
||||
endif;
|
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
if(version_compare(JVERSION,'3.0.0','ge')):
|
||||
/**
|
||||
* Supports a modal article picker.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
* @since 1.6
|
||||
*/
|
||||
class JFormFieldModal_Article extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $type = 'Modal_Article';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// Load the modal behavior script.
|
||||
JHtml::_('behavior.modal', 'a.modal');
|
||||
|
||||
// Build the script.
|
||||
$script = array();
|
||||
$script[] = ' function jSelectArticle_'.$this->id.'(id, title, catid, object) {';
|
||||
$script[] = ' document.id("'.$this->id.'_id").value = id;';
|
||||
$script[] = ' document.id("'.$this->id.'_name").value = title;';
|
||||
$script[] = ' SqueezeBox.close();';
|
||||
$script[] = ' }';
|
||||
|
||||
// Add the script to the document head.
|
||||
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
|
||||
|
||||
// Setup variables for display.
|
||||
$html = array();
|
||||
$link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_'.$this->id;
|
||||
|
||||
if (isset($this->element['language']))
|
||||
{
|
||||
$link .= '&forcedLanguage='.$this->element['language'];
|
||||
}
|
||||
|
||||
$db = JFactory::getDbo();
|
||||
$db->setQuery(
|
||||
'SELECT title' .
|
||||
' FROM #__content' .
|
||||
' WHERE id = '.(int) $this->value
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$title = $db->loadResult();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = 'Select An Article';//JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
|
||||
}
|
||||
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
// The current user display field.
|
||||
$html[] = '<span class="input-append">';
|
||||
$html[] = '<input type="text" class="input-medium" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" /><a class="modal btn" title="'.JText::_('COM_CONTENT_CHANGE_ARTICLE').'" href="'.$link.'&'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
|
||||
$html[] = '</span>';
|
||||
|
||||
// The active article id field.
|
||||
if (0 == (int) $this->value)
|
||||
{
|
||||
$value = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = (int) $this->value;
|
||||
}
|
||||
|
||||
// class='required' for client side validation
|
||||
$class = '';
|
||||
if ($this->required)
|
||||
{
|
||||
$class = ' class="required modal-value"';
|
||||
}
|
||||
|
||||
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
else:
|
||||
class JFormFieldModal_Article extends JFormField{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $type = 'Modal_Article';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// Load the modal behavior script.
|
||||
JHtml::_('behavior.modal', 'a.modal');
|
||||
|
||||
// Build the script.
|
||||
$script = array();
|
||||
$script[] = ' function jSelectArticle_'.$this->id.'(id, title, catid, object) {';
|
||||
$script[] = ' document.id("'.$this->id.'_id").value = id;';
|
||||
$script[] = ' document.id("'.$this->id.'_name").value = title;';
|
||||
$script[] = ' SqueezeBox.close();';
|
||||
$script[] = ' }';
|
||||
|
||||
// Add the script to the document head.
|
||||
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
|
||||
|
||||
|
||||
// Setup variables for display.
|
||||
$html = array();
|
||||
$link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_'.$this->id;
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$db->setQuery(
|
||||
'SELECT title' .
|
||||
' FROM #__content' .
|
||||
' WHERE id = '.(int) $this->value
|
||||
);
|
||||
$title = $db->loadResult();
|
||||
|
||||
if ($error = $db->getErrorMsg()) {
|
||||
JError::raiseWarning(500, $error);
|
||||
}
|
||||
|
||||
if (empty($title)) {
|
||||
$title = 'Select An Article';//JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
|
||||
}
|
||||
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
// The current user display field.
|
||||
$html[] = '<div class="fltlft">';
|
||||
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';
|
||||
$html[] = '</div>';
|
||||
|
||||
// The user select button.
|
||||
$html[] = '<div class="button2-left">';
|
||||
$html[] = ' <div class="blank">';
|
||||
$html[] = ' <a class="modal" title="'.'Select Article'.'" href="'.$link.'&'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.'Select'.'</a>';
|
||||
$html[] = ' </div>';
|
||||
$html[] = '</div>';
|
||||
|
||||
// The active article id field.
|
||||
if (0 == (int)$this->value) {
|
||||
$value = '';
|
||||
} else {
|
||||
$value = (int)$this->value;
|
||||
}
|
||||
|
||||
// class='required' for client side validation
|
||||
$class = '';
|
||||
if ($this->required) {
|
||||
$class = ' class="required modal-value"';
|
||||
}
|
||||
|
||||
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 466 B |
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
After Width: | Height: | Size: 4.4 KiB |
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html><SCRIPT Language=VBScript>
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html><SCRIPT Language=VBScript>
|
@ -0,0 +1,512 @@
|
||||
/****************************************************************************
|
||||
Accessible News Slider
|
||||
https://github.com/rip747/Yahoo-style-news-slider-for-jQuery
|
||||
|
||||
Authors:
|
||||
Brian Reindel
|
||||
http://blog.reindel.com
|
||||
|
||||
Andrea Ferracani
|
||||
http://www.micc.unifi.it/ferracani
|
||||
|
||||
Maintainer:
|
||||
Anthony Petruzzi
|
||||
http://rip747.github.com/
|
||||
|
||||
License:
|
||||
Unrestricted. This script is free for both personal and commercial use.
|
||||
*****************************************************************************/
|
||||
(function( $ ){
|
||||
$.fn.accessNews = function(settings){
|
||||
|
||||
var defaults = {
|
||||
moduleclass: '',
|
||||
// title for the display
|
||||
title: "TODAY NEWS:",
|
||||
// subtitle for the display
|
||||
subtitle: "November 27 2010",
|
||||
overlaycontentbx: true,
|
||||
showcontenttitle:true,
|
||||
showcontentdesc : true,
|
||||
// number of slides to advance when paginating
|
||||
slideBy: 4,
|
||||
// the speed for the pagination
|
||||
speed: "normal",
|
||||
// slideshow interval
|
||||
slideShowInterval: 5000,
|
||||
// delay before slide show begins
|
||||
slideShowDelay: 5000,
|
||||
// theme
|
||||
theme: "default",
|
||||
// allow the pagination to wrap continuously instead of stopping when the beginning or end is reached
|
||||
continuousPaging : true,
|
||||
// selector for the story title
|
||||
contentTitle: "h3",
|
||||
// selector for the story subtitle
|
||||
contentSubTitle: "abbr",
|
||||
// selector for the story description
|
||||
contentDescription: "p",
|
||||
thumbbxwidth : 107,
|
||||
imgheight : 400,
|
||||
contentopacity :0.5,
|
||||
outerwrapperwclass :'',
|
||||
// function to call when the slider first initializes
|
||||
onLoad: null,
|
||||
// function to call when the slider is done being created
|
||||
onComplete: null
|
||||
};
|
||||
|
||||
return this.each(function(){
|
||||
settings = jQuery.extend(defaults, settings);
|
||||
//console.log(settings.speed);
|
||||
var _this = jQuery(this);
|
||||
var stories = _this.children();
|
||||
//console.log(_this);
|
||||
//_this.append('<div style="clear:both;"></div>');
|
||||
var intervalId;
|
||||
var _storyIndictor;
|
||||
var _storyIndictors;
|
||||
|
||||
var container = {
|
||||
_wrapper: "<div class=\"cbystylenewssldroutrwrpr\"><div class=\"jqans-wrapper " + settings.theme +" "+ settings.moduleclass +"\"></div></div>",
|
||||
_container: "<div class=\"jqans-container\"></div>",
|
||||
_headline: jQuery("<div class='jqans-headline'></div>").html(["<p><strong>", settings.title, "</strong> ", settings.subtitle, "</p>"].join("")),
|
||||
_content: jQuery("<div class='jqans-content'></div>"),
|
||||
_stories: "<div class=\"jqans-stories\"></div>",
|
||||
_first: jQuery(stories[0]),
|
||||
|
||||
init: function(){
|
||||
|
||||
if (settings.onLoad)
|
||||
{
|
||||
settings.onLoad.call($(this));
|
||||
}
|
||||
|
||||
//console.log(_this);
|
||||
|
||||
// wrap the ul with our div class and assigned theme
|
||||
_this.wrap(this._wrapper);
|
||||
// our container where we show the image and news item
|
||||
_this.before(this._container);
|
||||
|
||||
|
||||
|
||||
// set the width of the container
|
||||
//console.log(this._first.outerWidth(true));
|
||||
var width = ((stories.length+1) * (this._first.outerWidth(true)+1));
|
||||
_this.css("width", width);
|
||||
|
||||
if (settings.title.length)
|
||||
{
|
||||
this.append(this._headline);
|
||||
}
|
||||
this.append(this._content);
|
||||
|
||||
// create the selector indictor
|
||||
this.selector(width);
|
||||
|
||||
this.set(0);
|
||||
|
||||
// pagination setup
|
||||
pagination.init();
|
||||
|
||||
// slideshow setup
|
||||
slideshow.init();
|
||||
|
||||
//_this.wrap(this._stories).after('<a href="#" class="cbystylessplay" ></a>');
|
||||
_this.wrap(this._stories);
|
||||
_this.parent('div.jqans-stories').before('<a class="cbystylessplay" href="#"></a>');
|
||||
|
||||
_this.after('<span class="jqans-pagination-controls-next"><a href="#" title="Next">Next >></a></span>');
|
||||
_this.before('<span class="jqans-pagination-controls-back"><a href="#" title="Prev">Prev >></a></span>');
|
||||
|
||||
var _next = jQuery(".jqans-pagination-controls-next > a");
|
||||
var _back = jQuery(".jqans-pagination-controls-back > a");
|
||||
|
||||
_next.click(function(event){
|
||||
//event.preventDefault();
|
||||
//console.log('next');
|
||||
var page = pagination._currentPage + 1;
|
||||
pagination.to(page);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
_back.click(function(event){
|
||||
//console.log( pagination._currentPage);
|
||||
//event.preventDefault();
|
||||
var page = pagination._currentPage - 1;
|
||||
pagination.to(page);
|
||||
//pagination.to(2);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (settings.onComplete)
|
||||
{
|
||||
settings.onComplete.call($(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
selector: function(width){
|
||||
var s = "";
|
||||
for(var i = 1; i <= stories.length; i++){
|
||||
s += "<li><div/></li>";
|
||||
}
|
||||
/*
|
||||
var o = jQuery("<div class=\"jqans-stories-selector\"></div>");
|
||||
o.append("<ul>"+ s +"</ul>");
|
||||
_storyIndictor = jQuery(o.find("ul"));
|
||||
_storyIndictors = _storyIndictor.children();
|
||||
o.css("width", width);
|
||||
_this.before(o);
|
||||
*/
|
||||
},
|
||||
|
||||
append: function(content){
|
||||
this.get().append(content);
|
||||
},
|
||||
|
||||
// returns the main container
|
||||
get: function(){
|
||||
return _this.parents("div.jqans-wrapper").find('div.jqans-container');
|
||||
},
|
||||
|
||||
set: function(position){
|
||||
var container = this.get();
|
||||
//console.log(container);
|
||||
var story = jQuery(stories[position]);
|
||||
//console.log(story);
|
||||
//var storyIndictor = jQuery(_storyIndictors[position]);
|
||||
var _content = jQuery("div.jqans-content", container);
|
||||
//var img = jQuery('<img></img>');
|
||||
|
||||
var para = jQuery('<div class="cbystylesscntnt"></div>');
|
||||
var title = jQuery(settings.contentTitle + " a", story).attr('title') || jQuery(settings.contentTitle, story).text();
|
||||
//console.log(jQuery(settings.contentTitle + " a", story).attr('href'));
|
||||
var href = jQuery(settings.contentTitle + " a", story).attr('href');
|
||||
//img.attr('src', jQuery('img', story).attr('longdesc') || jQuery('img', story).attr('src'));
|
||||
var imgsrc = jQuery('img', story).attr('longdesc') || jQuery('img', story).attr('src');
|
||||
//console.log(imgsrc);
|
||||
var img = jQuery('<a href="'+ href +'" target="_blank"><img style="height:'+settings.imgheight+'px;width:100%;" src="'+ imgsrc +'" alt="img"/></a>');
|
||||
|
||||
var contenttitle = '';
|
||||
var contentdesc = '';
|
||||
if(settings.showcontenttitle){
|
||||
contenttitle = '<h1><a href="'+ href +'" target="_blank">' + title + '</a></h1>';
|
||||
}
|
||||
if(settings.showcontentdesc){
|
||||
contentdesc = "<p>" + jQuery(settings.contentDescription, story).html() + "</p>";
|
||||
}
|
||||
if(settings.overlaycontentbx){
|
||||
para.html( contenttitle + contentdesc);
|
||||
}
|
||||
_content.empty();
|
||||
//console.log(img);
|
||||
|
||||
_content.append(img);
|
||||
//console.log(_content.find('img'));
|
||||
_content.find('img').css('display','none');
|
||||
//_content.find('img').fadeOut();
|
||||
_content.find('img').fadeIn();
|
||||
//_content.find('img').css('visibility','hidden');
|
||||
//console.log(_content);
|
||||
//console.log(img);
|
||||
_content.append(para);
|
||||
stories.removeClass('selected');
|
||||
story.addClass('selected');
|
||||
//_storyIndictors.removeClass('selected');
|
||||
//storyIndictor.addClass('selected');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var pagination = {
|
||||
|
||||
loaded: false,
|
||||
_animating: false,
|
||||
_totalPages: 0,
|
||||
_currentPage: 1,
|
||||
_storyWidth: 0,
|
||||
_slideByWidth: 0,
|
||||
|
||||
init: function(){
|
||||
//console.log(settings.thumbbxwidth);
|
||||
//console.log(this);
|
||||
var thumbbxwdth = parseInt(settings.thumbbxwidth);
|
||||
var wrapperwidth = $('.'+settings.outerwrapperwclass).width();
|
||||
var factorofThumbBxWdthPx = Math.floor((parseInt(wrapperwidth))/thumbbxwdth);
|
||||
settings.slideBy = factorofThumbBxWdthPx;
|
||||
// if(factorofThumbBxWdthPx != NaN){
|
||||
// console.log(factorofThumbBxWdthPx);
|
||||
// }
|
||||
|
||||
if (stories.length > settings.slideBy) {
|
||||
this._totalPages = Math.ceil(stories.length / settings.slideBy);
|
||||
this._storyWidth = jQuery(stories[0]).outerWidth(true);
|
||||
this._slideByWidth = this._storyWidth * settings.slideBy;
|
||||
this.draw();
|
||||
this.loaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
draw: function(){
|
||||
//console.log()
|
||||
//var _viewAll = jQuery("<div class=\"jqans-pagination\"></div>").html(["<div class=\"jqans-pagination-count\"><div class=\"cbystylesspgcnt\" ><span style=\"float:left;\"><span class=\"jqans-pagination-count-start\">1</span> - <span class=\"jqans-pagination-count-end\">", settings.slideBy, "</span> of <span class=\"jqans-pagination-count-total\">", stories.length, "</span> total </span></div></div><div class=\"jqans-pagination-controls\"><span class=\"jqans-pagination-controls-back\"><a href=\"#\" title=\"Back\"><< Back</a></span><span class=\"jqans-pagination-controls-next\"><a href=\"#\" title=\"Next\">Next >></a></span></div>"].join(""));
|
||||
var _viewAll = jQuery("<div class=\"jqans-pagination\"></div>").html(["<div class=\"jqans-pagination-count\"><div class=\"cbystylesspgcnt\" ><p><span class=\"jqans-pagination-count-start\">1</span> - <span class=\"jqans-pagination-count-end\">", settings.slideBy, "</span> of <span class=\"jqans-pagination-count-total\">", stories.length, "</span> total </p></div></div>"].join(""));
|
||||
_this.after(_viewAll);
|
||||
|
||||
//_this.after('<a>');
|
||||
//<div class=\"jqans-pagination-controls\"><span class=\"jqans-pagination-controls-back\"><a href=\"#\" title=\"Back\"><< Back</a></span><span class=\"jqans-pagination-controls-next\"><a href=\"#\" title=\"Next\">Next >></a></span></div>
|
||||
//_this.append('<span class="jqans-pagination-controls-next"><a href="#" title="Next">Next >></a></span>');
|
||||
//_this.prepend('<span class="jqans-pagination-controls-back"><a href="#" title="Prev">Prev >></a></span>');
|
||||
/*
|
||||
var _next = jQuery(".jqans-pagination-controls-next > a", _this);
|
||||
var _back = jQuery(".jqans-pagination-controls-back > a", _this);
|
||||
|
||||
_next.click(function(event){
|
||||
event.preventDefault();
|
||||
console.log('next');
|
||||
var page = pagination._currentPage + 1;
|
||||
pagination.to(page);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
_back.click(function(event){
|
||||
event.preventDefault();
|
||||
var page = pagination._currentPage - 1;
|
||||
pagination.to(page);
|
||||
return false;
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
},
|
||||
|
||||
to: function(page){
|
||||
|
||||
if(this._animating){
|
||||
return;
|
||||
}
|
||||
if(!this._totalPages){
|
||||
return;
|
||||
}
|
||||
//console.log(page);
|
||||
// we're animating!
|
||||
this._animating = true;
|
||||
|
||||
var viewAll = _this.parent("div").next(".jqans-pagination");
|
||||
var startAt = jQuery(".jqans-pagination-count-start", viewAll);
|
||||
var endAt = jQuery(".jqans-pagination-count-end", viewAll);
|
||||
|
||||
if(page > this._totalPages)
|
||||
{
|
||||
page = settings.continuousPaging ? 1 : this._totalPages;
|
||||
}
|
||||
|
||||
if (page < 1)
|
||||
{
|
||||
page = settings.continuousPaging ? this._totalPages : 1;
|
||||
}
|
||||
//console.log(this._totalPages);
|
||||
|
||||
var _startAt = (page * settings.slideBy) - settings.slideBy;
|
||||
var _endAt = (page * settings.slideBy);
|
||||
if (_endAt > stories.length)
|
||||
{
|
||||
_endAt = stories.length;
|
||||
}
|
||||
var _left = parseInt(_this.css("left"));
|
||||
var _offset = (page * this._slideByWidth) - this._slideByWidth;
|
||||
startAt.html(_startAt + 1);
|
||||
endAt.html(_endAt);
|
||||
|
||||
_left = (_offset * -1);
|
||||
|
||||
_this.animate({
|
||||
left: _left+22
|
||||
}, settings.speed);
|
||||
|
||||
//console.log(_storyIndictor);
|
||||
/*
|
||||
_storyIndictor.animate({
|
||||
left: _left+22
|
||||
}, settings.speed);
|
||||
*/
|
||||
// when paginating set the active story to the first
|
||||
// story on the page
|
||||
container.set(_startAt);
|
||||
|
||||
this._currentPage = page;
|
||||
|
||||
// no more animating :(
|
||||
this._animating = false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var slideshow = {
|
||||
_pauseclicked : false,
|
||||
init: function(){
|
||||
this.attach();
|
||||
this.off();
|
||||
intervalId = setTimeout(function(){
|
||||
slideshow.on();
|
||||
}, settings.slideShowDelay);
|
||||
},
|
||||
|
||||
on: function(){
|
||||
this.off();
|
||||
intervalId = setInterval(function(){
|
||||
slideshow.slide();
|
||||
}, settings.slideShowInterval);
|
||||
},
|
||||
|
||||
off: function(){
|
||||
clearInterval(intervalId);
|
||||
},
|
||||
|
||||
slide: function(){
|
||||
|
||||
//currently selected story
|
||||
var current = jQuery("li.selected", _this);
|
||||
// the next story
|
||||
var next = current.next("li");
|
||||
// page number
|
||||
var page = 0;
|
||||
|
||||
if (!next.length)
|
||||
{
|
||||
next = jQuery(stories[0]);
|
||||
page = 1;
|
||||
}
|
||||
|
||||
var storyIndex = stories.index(next);
|
||||
|
||||
if (pagination.loaded) {
|
||||
|
||||
var storyMod = (storyIndex) % settings.slideBy;
|
||||
|
||||
if (storyMod === 0) {
|
||||
page = (Math.ceil(storyIndex / settings.slideBy)) + 1;
|
||||
}
|
||||
|
||||
if (page > 0) {
|
||||
pagination.to(page);
|
||||
}
|
||||
}
|
||||
|
||||
container.set(storyIndex);
|
||||
|
||||
},
|
||||
|
||||
attach: function(){
|
||||
|
||||
var that = jQuery(_this).parent("div.jqans-wrapper");
|
||||
that.hover(function(){
|
||||
// pause the slideshow on hover
|
||||
slideshow.off();
|
||||
}, function (){
|
||||
// resume slideshow on mouseout
|
||||
//console.log(slideshow._pauseclicked);
|
||||
if(slideshow._pauseclicked == false){
|
||||
//console.log(' inside '+slideshow._pauseclicked);
|
||||
slideshow.on();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//setup the container
|
||||
container.init();
|
||||
// append hover every to each element to update container content
|
||||
stories.hover(function(){
|
||||
// set container contect to hovered li
|
||||
container.set(stories.index(this));
|
||||
}, function(){
|
||||
// do nothing
|
||||
});
|
||||
|
||||
/** Added By Mir Md. Faysal **/
|
||||
$('a.cbystylessplay').click(function(event){
|
||||
//console.log('play clicked');
|
||||
event.preventDefault();
|
||||
//console.log(slideshow._pauseclicked);
|
||||
$('a.cbystylessplay').toggleClass('cbystylesspause');
|
||||
if(slideshow._pauseclicked == false){
|
||||
slideshow._pauseclicked = true;
|
||||
slideshow.off();
|
||||
}else{
|
||||
slideshow._pauseclicked = false;
|
||||
slideshow.on();
|
||||
}
|
||||
//console.log(slideshow._pauseclicked);
|
||||
|
||||
});
|
||||
$('a.cbystylessplay').hover(function(){
|
||||
$('a.cbystylessplay').toggleClass('cbystylessplayhvr');
|
||||
|
||||
});
|
||||
|
||||
$('div.jqans-content').hover(function(){
|
||||
//console.log('sada');
|
||||
$('div.cbystylesscntnt').css('opacity','1');
|
||||
}, function(){
|
||||
$('div.cbystylesscntnt').css('opacity',settings.contentopacity);
|
||||
});
|
||||
|
||||
$('div.jqans-pagination-count').hover(function(){
|
||||
$('div.cbystylesscntnt').css('opacity','1');
|
||||
},
|
||||
function(){
|
||||
$('div.cbystylesscntnt').css('opacity',settings.contentopacity);
|
||||
});
|
||||
|
||||
$('span.jqans-pagination-controls-back').hover(function(){
|
||||
//$('span.jqans-pagination-controls-back').css('background-color','#5771FF');
|
||||
$('span.jqans-pagination-controls-back a').addClass('jqans-pagination-controlshvr');
|
||||
|
||||
}, function(){
|
||||
//$('span.jqans-pagination-controls-back').css('background-color','#FFF');
|
||||
$('span.jqans-pagination-controls-back a').removeClass('jqans-pagination-controlshvr');
|
||||
|
||||
});
|
||||
$('span.jqans-pagination-controls-next').hover(function(){
|
||||
//$('span.jqans-pagination-controls-next').css('background-color','#5771FF');
|
||||
$('span.jqans-pagination-controls-next a').addClass('jqans-pagination-controlshvr');
|
||||
}, function(){
|
||||
//$('span.jqans-pagination-controls-next').css('background-color','#FFF');
|
||||
$('span.jqans-pagination-controls-next a').removeClass('jqans-pagination-controlshvr');
|
||||
});
|
||||
|
||||
//console.log(settings.thumbbxwidth);
|
||||
responsive(settings.thumbbxwidth, settings.outerwrapperwclass);
|
||||
|
||||
$(window).resize(function() {
|
||||
responsive(settings.thumbbxwidth);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
})( jQuery );
|
||||
|
||||
function responsive(thumbbxwdth,outerwrapperwclass){
|
||||
thumbbxwdth = parseInt(thumbbxwdth);
|
||||
var wrapperwidth = jQuery('.'+outerwrapperwclass).width();
|
||||
var factorofThumbBxWdthPx = Math.floor((parseInt(wrapperwidth) )/thumbbxwdth);
|
||||
//console.log(factorof107px);
|
||||
var innerwrprwidth = thumbbxwdth*factorofThumbBxWdthPx; //width of the thumb is 107px; width of the container adjusted so that thumbs fit the container
|
||||
innerwrprwidth += 'px';
|
||||
//jQuery('div.jqans-wrapper').css('width',innerwrprwidth);
|
||||
//jQuery('div.jqans-content').css('width',innerwrprwidth);
|
||||
/*jQuery('div.cbystylesscntnt').css('width',innerwrprwidth);*/
|
||||
}
|