Skip to Content Skip to Menu

How to remove js scripts imported by Community Builder API please?

  • Nora75
  • Nora75
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
11 years 6 months ago - 11 years 6 months ago #225959 by Nora75
Hello!

First thanks for sharing this great component! I use CB API to show the content of some CB fields in my SobiPro entries. CB API imports this js script I would like to remove:
Code:
<script type="text/javascript"><!-- if ( typeof window.$ != 'undefined' ) { window.cbjqldr_tmpsave$ = window.$; } if ( typeof window.jQuery != 'undefined' ) { window.cbjqldr_tmpsavejquery = window.jQuery; } --></script><script type="text/javascript" src="http://www.site.com/components/com_comprofiler/js/jquery-1.5.2/jquery-1.5.2.min.js?v=ed87477bd99bbbd4"></script><script type="text/javascript"><!-- var cbjQuery = jQuery.noConflict( true ); --></script> <script type="text/javascript"><!-- window.$ = cbjQuery; window.jQuery = cbjQuery; --></script><script type="text/javascript" src="http://www.site.com/components/com_comprofiler/js/tabpane.min.js?v=0f28c76df57fcb1e"></script> <script type="text/javascript"><!-- cbjQuery( document ).ready( function( $ ) { var jQuery = $; var cbshowtabsArray = new Array(); function showCBTab( sName ) { if ( typeof(sName) == 'string' ) { sName = sName.toLowerCase(); } for (var i=0;i<cbshowtabsArray.length;i++) { for (var j=0;j<cbshowtabsArray[i][0].length;j++) { if (cbshowtabsArray[i][0][j] == sName) { eval(cbshowtabsArray[i][1]); return; } } } } }); if ( typeof window.cbjqldr_tmpsave$ != 'undefined' ) { window.$ = window.cbjqldr_tmpsave$; } if ( typeof window.cbjqldr_tmpsavejquery != 'undefined' ) { window.jQuery = window.cbjqldr_tmpsavejquery; } --></script>

Here is the php code I use in SobiPro:
Code:
public static function cb( $id, $mode) { global $_CB_framework, $mainframe; if ( defined( 'JPATH_ADMINISTRATOR' ) ) { if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) { echo 'CB not installed!'; return; } include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ); } else { if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) { echo 'CB not installed!'; return; } include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ); } $cbUser =& CBuser::getInstance( $id ); if ( ! $cbUser ) { $cbUser =& CBuser::getInstance( null ); } $name = $cbUser->getField( 'name', null, 'csv', 'none', 'list' ); $r = ''; if($mode === 'status') { $status = $cbUser->getField( 'onlinestatus' , null, 'csv', 'none', 'list' ); if($status === 'true') { $r .= '<span class="icon-eye-open online hasTip" title="'.Sobi::Txt('ONLINE').'"></span> '; } else { $r .= '<span class="icon-eye-close hasTip" title="'.Sobi::Txt('OFFLINE').'"></span> '; } } if($mode === 'link') { if(!empty($name)) { $r .= '<a class="url" href="'.$_CB_framework->userProfileUrl( $id, true ).'"><span class="fn name hasTip" title="'.Sobi::Txt('SEE_PROFILE').'" itemprop="name">'.$name.'</span></a>'; } else { $r .= Sobi::Txt('GUEST'); } } if($mode === 'avatar') { if(!empty($name)) { $r .= '<a href="'.$_CB_framework->userProfileUrl( $id, true ).'"><img class="photo hasTip" itemprop="image" src="'.$cbUser->getField( 'avatar', null, 'csv', 'none', 'list' ).'" alt="'.$name.'" title="'.$name.'"/></a>'; // $cbUser->getField( 'avatar', null, 'html', 'none', 'list' ); } else { $r .= '<div class="nouser"><i class="icon-user icon-nouser"></i><div class="clearfix"></div></div>'; } } if($mode === 'register') { $r .= $_CB_framework->viewUrl( 'registers', true ); } if($mode === 'profile') { if(!empty($name)) { $phone = $cbUser->getField( 'cb_phone', null , 'html', 'none', 'list' ); $website = $cbUser->getField( 'cb_website', null, 'html', 'none', 'list' ); $company = $cbUser->getField( 'cb_company', null, 'html', 'none', 'list' ); $occupation = $cbUser->getField( 'cb_occupation', null, 'html', 'none', 'list' ); if(!empty($phone)){ $r .= '<p><i class="icon-phone-sign"></i> <span class="tel" itemprop="telephone">' .$phone.'</span></p>'; } if(!empty($website)){ $r .= '<p><i class="icon-globe"></i> <span class="url" itemprop="url">' .$website.'</span></p>'; } $r .= '<div class="adr"><p><b>' .Sobi::Txt('COUNTRY'). '</b><span class="country-name" itemprop="nationality">' .$cbUser->getField( 'cb_country', null , 'html', 'none', 'list' ).'</span></p><p><b>' .Sobi::Txt('CITY'). '</b><span class="locality">'.$cbUser->getField( 'cb_city', null , 'html', 'none', 'list' ).'</span></p></div>'; if(!empty($company)){ $r .= '<p><b>' .Sobi::Txt('COMPANY'). '</b><span class="org" itemprop="worksFor">' .$company. '</span></p>'; } if(!empty($occupation)){ $r .= '<p><b>'. Sobi::Txt('OCCUPATION'). '</b><span class="title" itemprop="jobTitle">' .$occupation.'</span></p>'; } } else { $r .= '<p>'.Sobi::Txt('NOTAMEMBER').'</p>'; } } return $r; }

Is there a way to use CB API without importing javascript please ?
Thank you very much !
Last edit: 11 years 6 months ago by Nora75.

Please Log in or Create an account to join the conversation.

  • Nora75
  • Nora75
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
11 years 6 months ago - 11 years 6 months ago #226140 by Nora75
Hello,

I guess there's a little a mistake in the public function getField()
Line 1134 /www/administrator/components/com_comprofiler/plugin.foundation.php

Code:
$tabs =& $this->_getCbTabs();
Should be
Code:
$tabs =& $this->_getCbTabs(false);

There's the public function getTab to create tabs.

I don't see any reason why js scripts are imported by using the function getfields. It doesn't make sense for me.

Please could someone clarify this point ?

Thanks you very much.
Last edit: 11 years 6 months ago by Nora75.

Please Log in or Create an account to join the conversation.

  • Pere LK
  • Pere LK
  • OFFLINE
  • Posts: 114
  • Thanks: 2
  • Karma: 1
11 years 5 months ago #228541 by Pere LK
Somewhere I have same pb :
When I use the json output of K2 Cb add his js code in the header of the json file making it not legit
Code:
<script type="text/javascript"><!-- if ( typeof window.$ != 'undefined' ) { window.cbjqldr_tmpsave$ = window.$; } if ( typeof window.jQuery != 'undefined' ) { window.cbjqldr_tmpsavejquery = window.jQuery; } --></script><script type="text/javascript" src="http://www.oxalis-scop.fr/components/com_comprofiler/js/jquery-1.5.2/jquery-1.5.2.min.js?v=5dc7803a8da6c3b1"></script><script type="text/javascript"><!-- var cbjQuery = jQuery.noConflict( true ); --></script> <script type="text/javascript"><!-- window.$ = cbjQuery; window.jQuery = cbjQuery; --></script><script type="text/javascript" src="http://www.oxalis-scop.fr/components/com_comprofiler/js/tabpane.min.js?v=5dc7803a8da6c3b1"></script> <script type="text/javascript"><!-- cbjQuery( document ).ready( function( $ ) { var jQuery = $; var cbshowtabsArray = new Array(); function showCBTab( sName ) { if ( typeof(sName) == 'string' ) { sName = sName.toLowerCase(); } for (var i=0;i<cbshowtabsArray.length;i++) { for (var j=0;j<cbshowtabsArray[i][0].length;j++) { if (cbshowtabsArray[i][0][j] == sName) { eval(cbshowtabsArray[i][1]); return; } } } } }); if ( typeof window.cbjqldr_tmpsave$ != 'undefined' ) { window.$ = window.cbjqldr_tmpsave$; } if ( typeof window.cbjqldr_tmpsavejquery != 'undefined' ) { window.jQuery = window.cbjqldr_tmpsavejquery; } --></script>

Is this a CB issue ?

Please Log in or Create an account to join the conversation.

  • Aaman
  • Aaman
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
9 years 5 months ago #265345 by Aaman
any updates on this issue ?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum