Skip to content

Commit cc5beaf

Browse files
committed
Refactoring more snippets with modern jQuery docs
Removed deprecated jqLive snippet Added replacement jqOn snippet
1 parent ff4613a commit cc5beaf

24 files changed

+323
-280
lines changed
Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>jQuery: $.get() template</Title>
8+
<Title>jqGet</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqGet</Shortcut>
10+
<Description>Load data from the server using a HTTP GET request.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqGet</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>url</ID>
16-
<ToolTip>The URL for the request</ToolTip>
18+
<ToolTip>A string containing the URL to which the request is sent.</ToolTip>
1719
<Default>/url</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
19-
<Literal>
23+
<Literal Editable="true">
2024
<ID>data</ID>
21-
<ToolTip>Data to send (querystring)</ToolTip>
25+
<ToolTip>A plain object or string that is sent to the server with the request.</ToolTip>
2226
<Default>{ name: "value" }</Default>
27+
<Function>
28+
</Function>
2329
</Literal>
24-
<Literal>
25-
<ID>responseFormat</ID>
26-
<ToolTip>Options: xml|json|jsonp|text|html|script</ToolTip>
27-
<Default>selector</Default>
30+
<Literal Editable="true">
31+
<ID>dataType</ID>
32+
<ToolTip>The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).</ToolTip>
33+
<Default>json</Default>
34+
<Function>
35+
</Function>
2836
</Literal>
2937
</Declarations>
30-
<Code Language="JavaScript">
31-
<![CDATA[
32-
$$.get("$url$", $data$,
33-
function(data, status) {
38+
<Code Language="javascript"><![CDATA[$$.get("$url$", $data$,
39+
function(data, textStatus, jqXHR) {
3440
$end$
3541
},
36-
"$responseFormat$"
37-
);]]>
38-
</Code>
42+
"$dataType$"
43+
);]]></Code>
3944
</Snippet>
4045
</CodeSnippet>
41-
</CodeSnippets>
46+
</CodeSnippets>
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>jQuery: $.getJSON() template</Title>
8+
<Title>jqGetJson</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqGetJson</Shortcut>
10+
<Description>Load JSON-encoded data from the server using a GET HTTP request.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqGetJson</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>url</ID>
16-
<ToolTip>The URL for the request</ToolTip>
18+
<ToolTip>A string containing the URL to which the request is sent.</ToolTip>
1719
<Default>/url</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
19-
<Literal>
23+
<Literal Editable="true">
2024
<ID>data</ID>
21-
<ToolTip>Data to send (querystring)</ToolTip>
25+
<ToolTip>A plain object or string that is sent to the server with the request.</ToolTip>
2226
<Default>{ name: "value" }</Default>
27+
<Function>
28+
</Function>
2329
</Literal>
2430
</Declarations>
25-
<Code Language="JavaScript">
26-
<![CDATA[
27-
$$.getJSON("$url$", $data$,
28-
function(data) {
31+
<Code Language="javascript"><![CDATA[$$.getJSON("$url$", $data$,
32+
function(data, textStatus, jqXHR) {
2933
$end$
3034
}
31-
);]]>
32-
</Code>
35+
);]]></Code>
3336
</Snippet>
3437
</CodeSnippet>
35-
</CodeSnippets>
38+
</CodeSnippets>
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>jQuery: $.getScript() template</Title>
8+
<Title>jqGetScript</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqGetScript</Shortcut>
10+
<Description>Load a JavaScript file from the server using a GET HTTP request, then execute it.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqGetScript</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>url</ID>
16-
<ToolTip>URL of the script to be retrieved</ToolTip>
18+
<ToolTip>A string containing the URL to which the request is sent.</ToolTip>
1719
<Default>script.js</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
1923
</Declarations>
20-
<Code Language="JavaScript">
21-
<![CDATA[
22-
$$.getScript("$url$", function(){
24+
<Code Language="javascript"><![CDATA[$$.getScript("$url$", function(script, textStatus, jqXHR){
2325
$end$
24-
});]]>
25-
</Code>
26+
});]]></Code>
2627
</Snippet>
2728
</CodeSnippet>
28-
</CodeSnippets>
29+
</CodeSnippets>
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>jQuery: Check if selected elements contain class</Title>
8+
<Title>jqHasClass</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqHasClass</Shortcut>
10+
<Description>Determine whether any of the matched elements are assigned the given class.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqHasClass</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>selector</ID>
1618
<ToolTip>Element(s) to check</ToolTip>
1719
<Default>selector</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
19-
<Literal>
20-
<ID>name</ID>
21-
<ToolTip>Name of class to check for</ToolTip>
22-
<Default>name</Default>
23+
<Literal Editable="true">
24+
<ID>className</ID>
25+
<ToolTip>The class name to search for.</ToolTip>
26+
<Default>className</Default>
27+
<Function>
28+
</Function>
2329
</Literal>
2430
</Declarations>
25-
<Code Language="JavaScript">
26-
<![CDATA[var $name$HasClass = $$($selector$).hasClass($name$);$end$]]>
27-
</Code>
31+
<Code Language="javascript"><![CDATA[$$($selector$).hasClass($className$);$end$]]></Code>
2832
</Snippet>
2933
</CodeSnippet>
30-
</CodeSnippets>
31-
34+
</CodeSnippets>
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>jQuery: Gets the height of the first matched element.</Title>
8+
<Title>jqHeightGet</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqHeightGet</Shortcut>
10+
<Description>Get the current computed height for the first element in the set of matched elements.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqHeightGet</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>selector</ID>
16-
<ToolTip>jQuery selector</ToolTip>
18+
<ToolTip>Element to select</ToolTip>
1719
<Default>selector</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
1923
</Declarations>
20-
<Code Language="JavaScript">
21-
<![CDATA[$$($selector$).height();$end$]]>
22-
</Code>
24+
<Code Language="javascript"><![CDATA[$$($selector$).height();$end$]]></Code>
2325
</Snippet>
2426
</CodeSnippet>
25-
</CodeSnippets>
26-
27+
</CodeSnippets>
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>jQuery: Sets the height of the first matched element.</Title>
8+
<Title>jqHeightSet</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqHeightSet</Shortcut>
10+
<Description>Set the CSS height of every matched element.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqHeightSet</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>selector</ID>
16-
<ToolTip>jQuery selector</ToolTip>
18+
<ToolTip>Element(s) to select</ToolTip>
1719
<Default>selector</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
19-
<Literal>
20-
<ID>val</ID>
21-
<ToolTip>A positive number representing the desired height.</ToolTip>
22-
<Default>val</Default>
23+
<Literal Editable="true">
24+
<ID>value</ID>
25+
<ToolTip>An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string).</ToolTip>
26+
<Default>value</Default>
27+
<Function>
28+
</Function>
2329
</Literal>
2430
</Declarations>
25-
<Code Language="JavaScript">
26-
<![CDATA[$$($selector$).height($val$);$end$]]>
27-
</Code>
31+
<Code Language="javascript"><![CDATA[$$($selector$).height($value$);$end$]]></Code>
2832
</Snippet>
2933
</CodeSnippet>
30-
</CodeSnippets>
31-
34+
</CodeSnippets>
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>Effects: hide()</Title>
8+
<Title>jqHide</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqHide</Shortcut>
10+
<Description>Hide the matched elements.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqHide</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>selector</ID>
16-
<ToolTip>jQuery selector</ToolTip>
18+
<ToolTip>Element(s) to select</ToolTip>
1719
<Default>selector</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
1923
</Declarations>
20-
<Code Language="JavaScript">
21-
<![CDATA[$$($selector$).hide();$end$]]>
22-
</Code>
24+
<Code Language="javascript"><![CDATA[$$($selector$).hide();$end$]]></Code>
2325
</Snippet>
2426
</CodeSnippet>
25-
</CodeSnippets>
26-
27+
</CodeSnippets>
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
23
<CodeSnippet Format="1.4.0">
34
<Header>
45
<SnippetTypes>
56
<SnippetType>Expansion</SnippetType>
67
</SnippetTypes>
7-
<Title>Effects: hide(speed, callback)</Title>
8+
<Title>jqHideFull</Title>
89
<Author>John Sheehan (@johnsheehan)</Author>
9-
<Shortcut>jqHideFull</Shortcut>
10+
<Description>Hide the matched elements.</Description>
1011
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqHideFull</Shortcut>
1113
</Header>
1214
<Snippet>
1315
<Declarations>
14-
<Literal>
16+
<Literal Editable="true">
1517
<ID>selector</ID>
16-
<ToolTip>jQuery selector</ToolTip>
18+
<ToolTip>Element(s) to select.</ToolTip>
1719
<Default>selector</Default>
20+
<Function>
21+
</Function>
1822
</Literal>
19-
<Literal>
20-
<ID>speed</ID>
21-
<ToolTip>'slow', 'normal', 'fast' or milliseconds</ToolTip>
22-
<Default>speed</Default>
23+
<Literal Editable="true">
24+
<ID>duration</ID>
25+
<ToolTip>A string or number determining how long the animation will run.</ToolTip>
26+
<Default>"slow"</Default>
27+
<Function>
28+
</Function>
2329
</Literal>
2430
</Declarations>
25-
<Code Language="JavaScript">
26-
<![CDATA[$$($selector$).hide($speed$, function () {
31+
<Code Language="javascript"><![CDATA[$$($selector$).hide($duration$, function () {
2732
$end$
28-
});]]>
29-
</Code>
33+
});]]></Code>
3034
</Snippet>
3135
</CodeSnippet>
32-
</CodeSnippets>
33-
36+
</CodeSnippets>

0 commit comments

Comments
 (0)