using dasBaum: page is reloaded and entry is not made in tree - javascript

I am using dasBaum plug-in, the problem is, when i click on any of the 2 buttons to add the items the page is been reloaded and the item is not added to the tree.
What i have done in my page:i have created some tabs and 3rd tab i placed a div inside which the tree(that div which contains the items) is there.
U can see the dasBaum.js in the link i have given.
<html>
<head>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery-1.9.1.js" ></script>
<!--script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery-ui-1.8.18.custom.min.js"></script-->
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery.ui.timepicker.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/fullcalendar.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery-ui.multidatespicker.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/prettify.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery.multiselect2side.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery.tmpl.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/TableTools.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/ZeroClipboard.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/tab-menu.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/excellentexport.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/xlReader.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/eRoster.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/utils.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/linq.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/Require.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/dasBaum.js"></script>
<script type="text/javascript" src="<?php echo $jsPath; ?>js/json2.js"></script>
<script type="text/javascript" src="js/jquery.alerts.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
</head>
<!-- CREATED TABS DIV HERE, IN THIRD DIV I HAVE PUT "CONTAINER" DIV -->
<body>
------------------
------------------
<div id="container">
<center class="headline">
<button id="btFolder">New Folder</button>
<button id="btEntry">New Entry</button>
</center>
<div id="tree">
</div>
<div style="color:white">
<div class="headline">Features</div>
Drag&Drop to reorder items<br/>
Doubleclick to rename
<div class="headline">Hotkeys</div>
<strong>Space:</strong> Toggle Item<br/>
<strong>Up/Down:</strong> Move Cursor<br/>
<strong>Enter:</strong> Select<br/>
</div>
</div>
--------------
--------------
<script type="text/javascript">
$(function() {
$(document).keydown(function(e) {
$('#tree').dasBaum('handleKey',e);
})
$('#btFolder').click(function() {
$('#tree').dasBaum('addItem',{label:'New Entry',items:[]})
});
$('#btEntry').click(function() {
$('#tree').dasBaum('addItem',{label:'New Entry'});
});
console.log("bfore dasBaum");
debugger;
$('#tree').dasBaum({
sort: true,
foldersOnTop: true,
items: [
{
label:'D',
items: [{label:'E'}]
},
{label:'A'},
{label:'B'},
{label:'C'},
]
});debugger;
});
</script>
</body>
</html>
plz go to the link for dasBaum.js or .css files.
I am using jquery-ui-1.11.2.js in my project, this may make difference.

Related

Error: summernote is not a function when using local files

I am having a really odd problem. When I used my local summernote files to load the text editor, ".summernote is not a function" happened. However, if I used the cdn files to load the editor, everything went fine. Here is my HTML header code:
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="UTF-8"/>
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>"/>
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>"/>
<?php } ?>
<?php if ($keywords) { ?>
<meta name="keywords" content="<?php echo $keywords; ?>"/>
<?php } ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<link href="favicon.ico" rel="icon">
<!-- include jquery -->
<script type="text/javascript" src="javascript/jquery/jquery-2.1.1.min.js"></script>
<!-- include libraries BS3 -->
<script type="text/javascript" src="javascript/bootstrap/js/bootstrap.min.js"></script>
<link href="stylesheet/bootstrap.css" type="text/css" rel="stylesheet"/>
<!-- include font-awesome-->
<link href="javascript/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet"/>
<!-- include datetimepicker-->
<script src="javascript/jquery/datetimepicker/moment.js" type="text/javascript"></script>
<script src="javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<link href="javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen"/>
<!-- include customer stylesheet-->
<link type="text/css" href="stylesheet/stylesheet.css" rel="stylesheet" media="screen"/>
<!--include customer js-->
<script src="javascript/common.js" type="text/javascript"></script>
<?php if ($styles) { ;?>
<?php foreach ($styles as $style) { ;?>
<link href="<?php echo $style;?>" rel="stylesheet"></link>
<?php } ;?>
<?php } ;?>
<?php if ($scripts) { ;?>
<?php foreach ($scripts as $script) { ;?>
<script href="<?php echo $script;?>" type="text/javascript"></script>
<?php } ;?>
<?php } ;?>
<!-- <link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.css" rel="stylesheet">-->
<!-- <script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.js"></script>-->
I tried to load the local files directly instead of echo them by PHP, but the problem is still there.
I checked every href, there is no dead link.
Then I created a pure HTML called test.html file underneath the javascript folder, and the text editor loaded fine by using local files.
By the way the framework I'm using is CI, and the file structure is:
root
├──javascript
├──bootstrap
├──jquery
├──summernote
├──font-awesome
├──test.html
I don't think you're including your scripts in the right order.
When you loaded from the CDN, your order looked something like this:
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.js"></script>
<script src="javascript/common.js" type="text/javascript"></script>
. . . which is logical, because you want to be sure that summernote is loaded by the time your main JS code executes.
However, your PHP dependency management code was injecting the tags linking to local files after that same script. Basically, dump all of that logic before your customer's script too:
<?php if ($styles) { ;?>
<?php foreach ($styles as $style) { ;?>
<link href="<?php echo $style;?>" rel="stylesheet"></link>
<?php } ;?>
<?php } ;?>
<?php if ($scripts) { ;?>
<?php foreach ($scripts as $script) { ;?>
<script src="<?php echo $script;?>" type="text/javascript"></script>
<?php } ;?>
<?php } ;?>
<script src="javascript/common.js" type="text/javascript"></script>
(Also note that in your PHP you wrote href instead of src for your script tag generation.)
For me, I wanted to use summer note with bootstrap4, I copied the below code from the official documentation but it didn't work, I realized afterwards that I was embedding a newer bootstrap version at the beginning of my page (I was reaching out to some bootstrap files located at the assets), I removed that line and everything went just fine:
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/summernote#0.8.18/dist/summernote-bs4.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote#0.8.18/dist/summernote-bs4.min.js"></script>

TypeError: $.material is undefined in material design for boostrap

I am using a library from GITHUB FezVrasta/bootstrap-material-design
Now I have added all the CSS and JS files still in my console I get the error:
TypeError: $.material is undefined
I want the input effects as it shows in demo but due to this error its now working.
I have added the files like this:
<link rel="stylesheet" type="text/css" href="<?php echo site_url('fms_material_design/css/bootstrap-material-design.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo site_url('fms_material_design/css/ripples.min.css'); ?>">
<script src="<?php echo site_url('fms_material_design/js/material.js'); ?>"></script>
<script src="<?php echo site_url('fms_material_design/js/ripples.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo site_url('fms_material_design/js/jquery.nouislider.min.js'); ?>"></script>
<!--SNACKBAR BOOSTRAP TOAST -->
<link rel="stylesheet" type="text/css" href="<?php echo site_url('fms_material_design/snackbar/snackbar.min.css'); ?>">
<script type="text/javascript" src="<?php echo site_url('fms_material_design/snackbar/snackbar.min.js'); ?>"></script>

Custom JavaScript not working in Joomla 3 template

i have problem with including javascript in joomla 3 template code. I am trying to create slider menu with http://9bitstudios.github.io/flexisel/. Outside of joomla with only html and java code, menu works great. But when i try to implement into joomla template i cant get it working.
My template code:
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/reset.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/style.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/flexisel.css" type="text/css" />
<?php
JHtml::_('jquery.framework');
?>
<script type="text/javascript" src="templates/<?php echo $this->template ?>/js/jquery.flexisel.js"></script>
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
$("#flexiselDemo1").flexisel();
});
</script>
</head>
<body>
<div id="page">
<div id="head">
VOSSP
</div>
<div id="main-menu">
<jdoc:include type="modules" name="main-menu" />
</div>
<div id="footer">
</div>
</div>
</body>
</html>
I tryed using of $document->addScriptDeclaration and $document->addScript, from http://docs.joomla.org/Adding_JavaScript, but no change.
You are importing jQuery in noConflict mode, so try changing this:
$(window).load(function() {
$("#flexiselDemo1").flexisel();
});
to this:
jQuery(document).ready(function($) {
$("#flexiselDemo1").flexisel();
});
Note: go back to using JHtml::_('jquery.framework');

How to show title on popup on dialog box

<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$("#orderdetail1<?php echo $OrdersRows['ID'];?>").click(function(e){
e.preventDefault();
modalbox(this.href,this.title,550,800);
});
</script>
</head>
<body>
<div> <a id="orderdetail1<?php echo $OrdersRows['ID'];?>" href="<?php echo SITE_ADDRESS."ecommerce/orders/OrderListEdit.php"?>?id=<?php echo $OrdersRows['ID'];?>&Task=configration" title="<?php echo $OrdersRows['CompanyName']." - ".$OrdersRows['FirstName']." ".$OrdersRows['Surname']." - ".$OrdersRows['Phone'];?>"> <img src="../../images/icon_settings.png" border="0" title="<?php echo $OrdersRows['CompanyName']." - ".$OrdersRows['FirstName']." ".$OrdersRows['Surname']."'s Order Detail ";?>"/></a></div>
</body>
How to get title using this code. A dialog box is opening using this code but title is not showing

IE8 error with javascript file which has jQuery functions?

I'm getting this error in IE8:
Page Error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.5;. NET CLR 1.1.4322;. NET CLR 2.0.50727;. NET CLR 3.0.04506.30;. NET CLR 3.0.4506.2152;. NET CLR 3.5.30729;. NET4.0C)
Timestamp: Wed, 1 Sep 2010 11:15:04 UTC
Message: Object does not support this property or method
Row: 10
Character: 2
Code: 0
URI: http://widerdesign.com.tw/wp-content/themes/starkers/js/custom.js
custom.js:
$(document).ready(function () {
//easy slider
$('ul.sf-menu').superfish();
//easy slider
$("#slider").easySlider({
auto: true,
continuous: true
});
//fancybox
$("a#showcase1").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase2").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase3").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase4").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase5").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase6").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase7").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase8").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
$("a#showcase9").attr('rel', 'gallery').fancybox({
'scrolling' : 'no',
'titleShow' : false
});
});
head tags in header.php
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php
/*
* Print the <title> tag based on what is being viewed.
* We filter the output of wp_title() a bit -- see
* twentyten_filter_wp_title() in functions.php.
*/
wp_title( '|', true, 'right' );
?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/slider.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/superfish.css" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
*/
wp_head();
?>
</head>
included js files on footer:
</div><!-- #footer -->
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/custom.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/easySlider1.5.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/superfish.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/superfish.js"></script>
</body>
</html>
any suggestions?
The code is properly working on Chrome and Firefox (as expected)
You are including jQuery twice, which will wipe out any plugins defined on it since it defines $ and $.fn (before document.ready fires). To fix it only use one version of jQuery (multiple versions in a page do not play nicely, they're not designed to).
I think your footer should look like this overall:
</div><!-- #footer -->
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/easySlider1.5.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/superfish.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/custom.js"></script>
</body>
</html>
I would start by removing the extra references to superfish and jquery. IE may be handling those differently than the other browsers.
Here's what I think it should look like:
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/easySlider1.5.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/superfish.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/custom.js"></script>
It looks like you haven't included the jQuery file as well? It needs to appear on your page as an include above the line that includes your own file.

Categories