In select2 4.0 there isn't Italy i18n file - jquery-select2

In new select2 version Version 4.0.0 beta 2 there isn't support for Italy language in i18n folder.
I have already copy i18n/en.js file and rename in i18n/it.js but this does not work.
How can I fix it ?

include scripts :
<script src="{{ asset('assets/plugins/select2/dist/js/select2.min.js') }}"></script>
<script src="{{ asset('assets/plugins/select2/dist/js/i18n/it.js') }}"></script>
end the execution part :
<script type="text/javascript">
$(document).ready(function () {
$(".select2").select2({language: "it"});
// ...
});
</script>

Related

http://localhost:52951/app/app/app.module.js 404 (Not Found) scripts in layout not working

Im trying to add angular 5 to my mvc project for almost two days now and its not working. When I load the page I get these errors
my scripts view is an .ascx file and the scripts look like this
<!-- Polyfill(s) for older browsers -->
<base href="/">
<script src="<%: Url.ContentWithTimestamp("~/node_modules/core-js/client/shim.min.js") %>"></script>
<script src="<%: Url.ContentWithTimestamp("~/node_modules/zone.js/dist/zone.js") %>"></script>
<script src="<%: Url.ContentWithTimestamp("~/node_modules/systemjs/dist/system.src.js") %>"></script>
<script src="<%: Url.ContentWithTimestamp("~/systemjs.config.js") %>"></script>
<script>
SystemJS.import('<%: Url.ContentWithTimestamp("~/app/main.js") %>').catch(function(err){ console.error(err); });
</script>
Edit: This is the project I put angular in.
Here is one of the packages (dont want to upload img of everyone.They are there.)
The problem was in my main.js. This line:
var app_module_1 = require("./app/app.module");
should be like this:
var app_module_1 = require("./app.module");

jQuery UI error: TypeError: this._addClass is not a function [duplicate]

I am having an issue getting a dialog to work as basic functionality. Here is my jQuery source imports:
<script type="text/javascript" src="scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="scripts/jquery-ui-1.11.1.js"></script>
<script type="text/javascript" src="scripts/json.debug.js"></script>
Html:
<button id="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>
<script type="text/javascript">
$("#opener").click(function() {
$("#dialog1").dialog('open');
});
</script>
From the posts around seems like as a library import issue. I downloaded the JQuery UI Core, Widget, Mouse and Position dependencies.
Any Ideas?
Be sure to insert full version of jQuery UI. Also you should init the dialog first:
$(function () {
$( "#dialog1" ).dialog({
autoOpen: false
});
$("#opener").click(function() {
$("#dialog1").dialog('open');
});
});
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />
<button id="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>
if some reason two versions of jQuery are loaded (which is not recommended), calling $.noConflict(true) from the second version will return the globally scoped jQuery variables to those of the first version.
Some times it could be issue with older version (or not stable version) of JQuery files
Solution use $.noConflict();
<script src="other_lib.js"></script>
<script src="jquery.js"></script>
<script>
$.noConflict();
jQuery( document ).ready(function( $ ) {
$("#opener").click(function() {
$("#dialog1").dialog('open');
});
});
// Code that uses other library's $ can follow here.
</script>
If you comment out the following code from the _Layout.cshtml page, the modal popup will start working:
</footer>
#*#Scripts.Render("~/bundles/jquery")*#
#RenderSection("scripts", required: false)
</body>
</html>
Change jQueryUI to version 1.11.4 and make sure jQuery is not added twice.
I just experienced this with the line:
$('<div id="editor" />').dialogelfinder({
I got the error "dialogelfinder is not a function" because another component was inserting a call to load an older version of JQuery (1.7.2) after the newer version was loaded.
As soon as I commented out the second load, the error went away.
Here are the complete list of scripts required to get rid of this problem.
(Make sure the file exists at the given file path)
<script src="#Url.Content("~/Scripts/jquery-1.8.2.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery-ui-1.8.24.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript">
</script>
and also include the below css link in _Layout.cshtml for a stylish popup.
<link rel="stylesheet" type="text/css" href="../../Content/themes/base/jquery-ui.css" />
I had a similar problem and in my case, the issue was different (I am using Django templates).
The order of JS was incorrect (I know that's the first thing you check but I was almost sure that that was not the case, but it was). The js calling the dialog was called before jqueryUI library was called.
I am using Django, so was inheriting a template and using {{super.block}} to inherit code from the block as well to the template. I had to move {{super.block}} at the end of the block which solved the issue. The js calling the dialog was declared in the Media class in Django's admin.py. I spent more than an hour to figure it out. Hope this helps someone.

Angular material not working

I wanted to use angular material in an AngularJS application so I downloaded it with all its dependencies:
<script src="bower_components/hammer/hammer.js"></script>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-aria/angular-aria.min.js"></script>
<script src="bower_components/angular-animate/angular-animate.min.js"></script>
<script src="bower_components/angular-material/angular-material.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/angular-resource/angular-resource.min.js"></script>
And then I included it in my App:
var myApp = angular.module('myApp', ['ngRoute', 'ngResource', 'ngSanitize', 'ngMaterial', 'ngAnimate', 'ngAria']);
After that I wanted to try it on a button:
<md-container> <md-button>boutton1</md-button> </md-container>
And here is the result ( on Chrome and Firefox):
And when I click on it I have this:
Did I do something wrong?
It looks like you are not including the stylesheet.
Try adding the following:
<link rel="stylesheet" href="bower_components/angular-material/angular-material.min.css" type="text/css">
Alternatively, if you are using Angular CLI, you can insert this line #import "~#angular/material/prebuilt-themes/indigo-pink.css"; into your styles.css.
Just make sure to follow the official instructions https://material.angular.io/guide/getting-started

Checking for navigator.globalization on deviceready returns undefined on iOS

I am using PhoneGap 2.2.0 on iOS and binding to the devicready event to see if the navigator.globalization object is there. I am getting undefined.
My code looks like this:
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady()
{
alert('deviceready');
navigator.globalization.getLocaleName(function(d)
{
window.localStorage.setItem('localeLanguage', d.value);
console.log('localeLanguage: is'+d.value);
},
function(error)
{
console.log('error getting locale language');
});
}
The alert('deviceready') never fires. I am really at a loss here. I'm setting up my scripts as follows.
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="cordova-2.2.0.js"></script>
<script type="text/javascript">
//alert(typeof navigator.globalization);
</script>
<script src="js/jquery.ui.map.full.min.js"></script>
<script src="js/jquery.ui.map.services.min.js"></script>
<script src="js/jquery.i18n.min.js"></script>
<script src="js/languages.js"></script>
<script src="js/oakglobalization.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
<script type="text/javascript" src="js/custom.js"></script>
Any ideas would be helpful as this is a showstopper now.
Try :
$(document).ready(function() {
document.addEventListener("deviceready", onDeviceReady, false);
});
to add you event listener.
And maybe try to update your cordova version. The current version is the 2.6.0.
Another point : with phonegap, use the Navigator.notification.alert method instead of the native javascript alert. More info here.
Hope this helps ! Bye !
Not sure if you solved it or not, but at least for me ( PG 3.3.0 ) using navigator.globalization I had to install the cordova plugin and change the XML accordingly.
command-line> cordova plugin add org.apache.cordova.globalization
config.xml>
<feature name="Globalization">
<param name="ios-package" value="CDVGlobalization" />
</feature>
On that note, it didn't work on browser emulators ( ie.: ripple ) only on the real iOS xcode emulator ...
Backup your project just in case ;)

CKEditor 3.1 jquery adapter?

<script type="text/javascript" language="javascript" src="/Content/Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/Content/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/Content/ckeditor/adapders/jquery.js"></script>
<script type="text/javascript" language="javascript">
$(function() {
$('textarea.ckeditor').ckeditor();
});
</script>
<textarea class="ckeditor" cols="5" id="Title" name="Title" rows="5">
</textarea>
It all works fine but before loading page it alerts this "Microsoft JScript runtime error: Object doesn't support this property or method"
But it works after the Visual Studio alert, what might be the reason ?
Thanks in advance
You should put the code to create the CKEditor instance after the textarea element (or on the onload event of the page).
I don't think that this is also part of the problem, but the folder as distributed is named "adapters", not "adapders"
And it works later because the textarea has the class="ckeditor", so that textarea is automatically replaced: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.replaceClass

Resources